- Asked 2/14
- 2072 Magh · 1+3 marks
- 2070 Bhadra · 4 marks
Deadlock and its conditions
Short answer
Deadlock is permanent blocking where each process holds a resource and waits for another held by someone else. It needs four conditions together: mutual exclusion, hold and wait, no preemption, and circular wait.
What is deadlock? What are the conditions for deadlock to occur?
Deadlock
A deadlock is a situation in which a set of processes is blocked permanently because each process holds a resource and waits for another resource held by some other process in the set. None of them can proceed.
Example: process P1 holds the printer and requests the scanner; process P2 holds the scanner and requests the printer. Both wait for ever.
Necessary conditions (Coffman conditions)
Deadlock can occur only if all four conditions hold at the same time.
- Mutual exclusion: at least one resource is non-shareable, so only one process can use it at a time.
- Hold and wait: a process holding at least one resource is waiting to acquire more resources held by others.
- No preemption: a resource cannot be forcibly taken from a process; it is released only voluntarily after use.
- Circular wait: there is a closed chain of processes P1 → P2 → … → Pn → P1, where each process waits for a resource held by the next.
P1 holds R1, wants R2
P2 holds R2, wants R1
P1 --wants--> R2 --held by--> P2
P2 --wants--> R1 --held by--> P1 (cycle)
Deadlock is prevented by making at least one of these four conditions impossible.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Deadlock and Coffman conditions · Embedded System, chapter 6 · asked 4×
- Deadlock; necessary conditions with examples · Operating System, chapter 7
- Deadlock conditions; Banker's with 4 processes · Operating System, chapter 7
- Deadlock conditions and why all necessary · Operating System, chapter 7