Intuition
Each participant holds something another participant needs, so everyone is stuck.
Technical definition
Deadlock arises when conditions such as mutual exclusion, hold-and-wait, no preemption, and circular wait occur together.
Example
Thread A holds lock 1 and waits for lock 2 while thread B holds lock 2 and waits for lock 1.
Common misunderstandings
- Deadlock is different from slow performance.
- Adding more locks can increase deadlock risk.