Subj : Re: deadlock avoidance To : comp.programming.threads From : Sergey P. Derevyago Date : Fri May 20 2005 02:11 pm axter wrote: > Are there any good C++ methods, objects, or logic to avoid deadlocks? > Yes, definitely. Just avoid excessive locking and lock chains. The main idea is: MT is not about locking; MT is about parallel simultaneous execution. The good news is: A deadlock can arise only when you lock at least two synchronization primitives simultaneously. That is applications that don't use long lock chains are not likely to suffer from deadlock issues. And: Thoroughly designed MT applications don't use (long) lock chains to "ALLOW FOR concurrent or simultaneous execution". The bad news are: The most of realworld MT applications are poorly designed. The herds of mutexes are locked in unpredictable ways which effectively kills the contention and scalability. You can not avoid deadlocks and/or improve the performance of ill-designed MT application, you have to redesign. -- With all respect, Sergey. http://ders.angen.net/ mailto : ders at skeptik.net .