A deadlock requires all four Coffman conditions. Which is one of them?
Coffman conditions: deadlock needs mutual exclusion, hold-and-wait, no preemption, and circular wait. Breaking any one prevents deadlock; enforcing a global lock ordering breaks circular wait.
2 / 5
How does enforcing a global lock ordering prevent deadlock?
Lock ordering: if every thread always acquires locks A-then-B (never B-then-A), a circular wait is impossible. This is the most common practical defense against deadlock.
3 / 5
What is a livelock, as distinct from a deadlock?
Livelock: threads are not blocked - they are actively running - but their responses to each other prevent any from progressing (like two people stepping side to side in a hallway). Randomized backoff often resolves it.
4 / 5
How can a lock timeout help detect or recover from deadlock?
Timeout-based recovery: using tryLock with a timeout lets a thread give up, release held locks, and retry rather than waiting forever. This breaks hold-and-wait and avoids permanent deadlock.
5 / 5
A wait-for graph detects deadlock by looking for what?
Wait-for graph: nodes are threads and an edge T1 to T2 means T1 waits for a resource held by T2. A cycle in this graph indicates a deadlock; runtimes and databases use this to detect and abort a victim.