Deadlock
The essence
A deadlock is a state in which two or more threads wait for each other forever: each holds a resource the other needs, and none can proceed. The classic Coffman conditions: mutual exclusion, hold-and-wait, no preemption, circular wait. Breaking any one of them makes deadlock impossible.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep