⚠️ Key Point: ALL four conditions must hold simultaneously for deadlock to occur. Eliminating even ONE condition prevents deadlock.
1. Mutual Exclusion
At least one resource must be non-shareable — only one process can use it at a time.
Example: A printer can only be used by one process at a time.
2. Hold and Wait
A process is holding at least one resource and waiting to acquire additional resources held by other processes.
Example: P1 holds Printer and is waiting for Scanner.
3. No Preemption
Resources cannot be forcibly taken away from a process. A resource can only be released voluntarily by the process holding it.
Example: OS cannot forcibly take the printer away from P1.
4. Circular Wait
A set of processes {P0, P1, …, Pn} exist such that P0 is waiting for a resource held by P1, P1 is waiting for P2, …, Pn is waiting for P0.
Example: P1→P2→P3→P1 (circular chain)
Circular Wait Diagram:
P1 ──holds──► R1 ──needed by──► P2
▲ │
│ │
needs holds
│ │
R2 ◄──────────────────────────── R2
P1 waits for R2 (held by P2)
P2 waits for R1 (held by P1)
→ DEADLOCK!
Fig 1.1 — Circular Wait causing Deadlock