The four deadlock conditions — Aptitude Question
The four deadlock conditions: Which of these is not one of the four necessary conditions for deadlock? Answer and worked solution on CodeKairo.
- Topic: OS, DBMS & Networks
- Section: Programming MCQs
- Difficulty: Easy
- Time target: 60 seconds
Question
Which of these is not one of the four necessary conditions for deadlock?
Options
- Circular wait
- Hold and wait
- Mutual exclusion
- Priority inversion
Show the answer and the worked solution
Correct answer: D. Priority inversion
Worked solution
- The four conditions that must hold simultaneously are mutual exclusion, hold and wait, no preemption and circular wait.
- Break any one of them and deadlock becomes impossible, which is exactly how prevention schemes are designed.
- Priority inversion describes a high-priority task delayed by a lower-priority one holding a lock; it degrades response time but is not a deadlock condition.
Answer: Priority inversion.
The idea
Deadlock needs all four conditions at once. Coffman's list is worth memorising in order, because prevention questions always ask which condition a given rule attacks.
Shortcut. Coffman's four are mutual exclusion, hold and wait, no preemption and circular wait; priority inversion is a scheduling problem outside that list.
Common trap. "Mutual exclusion" sounds like a safeguard rather than a cause, so candidates strike it out, but deadlock is impossible on shareable resources, which makes it the first of the four.