Four Preconditions for Deadlock
Four conditions must be present for deadlock to occur:
1. Non-preemptability. Resource ownership (e.g., by threads) is non-preemptable.
Resources are never taken away from the holder.
2. Exclusion. Some thread cannot acquire a resource that is held by another thread.
3. Hold-and-wait. Holder blocks awaiting another resource.
4. Circular waiting. Threads acquire resources out of order.