Return to Contents



Deadlock

Four Conditions for Deadlock
All four conditions must be true for a deadlock to occur.

  1. mutual exclusion

  2. hold and wait

  3. no preemption

  4. circular wait

Three Ways of Dealing with Deadlock

  1. deadlock prevention

  2. deadlock avoidance

  3. deadlock detection and recovery


Sample Question:

(a) Draw the resource-allocation graph when the sets P, R, and E are:

P = {P1, P2, P3}

R = {R1, R2, R3, R4}

E = {P1 -->R1, P2 -->R1, P2 -->R2, P3 -->R4, R2 -->P3, R3 -->P1, and R4 -->P2}

Assume there exists one instance of each resource type. As well, assume resources R1, R2, R3, and R4 are nonpreemptive and cannot be shared.

(b) Could a deadlock exist in the system described in part (a)? Explain why or why not making reference to the necessary conditions for a deadlock.


Sample Answer:

(a) - not shown

(b) Yes, deadlock could exist. The four necessary conditions are all true.

Return to Contents