There are four conditions, known as the Coffman conditions, that are necessary for a deadlock to occur. Remove any one of these, and a deadlock can’t happen:
- Mutual exclusion.
There’s a resource that only one entity can use at a time.
- Hold and wait.
An entity is holding one resource while waiting for another.
- No preemption.
An entity gets to decide when it releases its hold on a resource.
- Circular wait.
There must be a cycle of waits, such that entity 1 is waiting on a resource held by entity 2; entity 2 is waiting on a resource held by entity 3; …; and entity N is waiting on a resource held by entity 1.
von .NET Parallel Programming http://blogs.msdn.com/b/pfxteam/archive/2012/04/12/10293249.aspx