The Deadlock Problem

A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.
  • System has 2 disk drives.
  • P1 and P2 each hold one disk drive and each needs another one.

  • semaphores A and B, initialized to 1
wait (A);wait(B)
wait (B);wait(A)

Bridge Crossing Example

bridge crossing example
  • Traffic only in one direction.
  • Each section of a bridge can be viewed as a resource.
  • If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback).
  • Several cars may have to be backed up if a deadlock occurs.
  • Starvation is possible.