← Operating Systems learning path
Operating Systems · Module 5 of 10

Deadlocks

Detect, prevent and avoid deadlocks.

📖 Key ideas

  1. Deadlock: processes wait forever for each other's resources.
  2. Four conditions: mutual exclusion, hold and wait, no preemption, circular wait.
  3. Prevention breaks one condition.
  4. Avoidance: Banker's algorithm keeps the system in a safe state.
  5. Detection and recovery: find cycles, then kill or preempt.
💡 Real-life example: Deadlock is four cars at a crossroads, each waiting for the one on its right to move.
DeadlockProcesses waiting on each other forever
Circular waitCycle of resource waiting
Banker's algorithmDeadlock avoidance method
Safe stateState where all can finish