Here are the conditions necessary for a deadlock to occur; note that all of them are necessary, and none is suf?cient:
1. ?nite resources: the resources are held in a mutually-exclusive way, and they can be exhausted, causing waiting.
2. hold-and-wait: each thread holds one resource while waiting for another.
3. no preemption: threads only release resources voluntarily. No other thread (or the OS) can force the thread to release its resources.
4. circular wait: we have a circular chain of waiting threads.