Project ForgeSign up free
Operating Systems
Deadlock & Resource Allocation
GATE 2009
Expert

Consider a system with 4 types of resources R1 (3 units), R2 (2 units), R3 (3 units), R4 (2 units). A non-preemptive resource allocation policy is used, where a request is not entertained if it cannot be completely satisfied. Three processes P1, P2, P3 request resources over time (P1: t=0 req 2R2, t=1 req 1R3, t=3 req 2R1, t=5 release 1R2+1R1, t=7 release 1R3, t=8 req 2R4, t=10 finish; P2: t=0 req 2R3, t=2 req 1R4, t=4 req 1R1, t=6 release 1R3, t=8 finish; P3: t=0 req 1R4, t=2 req 2R1, t=5 release 2R1, t=7 req 1R2, t=8 req 1R3, t=9 finish). Which one of the following statements is TRUE if all three processes run concurrently starting at t=0?

  • All processes will finish without any deadlock.
  • BOnly P1 and P2 will be in deadlock.
  • COnly P1 and P3 will be in deadlock.
  • DAll three processes will be in deadlock.

Explanation

Simulating the full timeline: P1's t=3 request for 2 R1 blocks (only 1 available after P3 takes 2 at t=2), but P3 releases its 2 R1 at t=5, which satisfies P1's pending request exactly then — P1 proceeds through its remaining steps. Later P1 blocks again at t=8 needing 2 R4 (both units held by P2 and P3), but P2 releases its R4 at t=8 (finishing) and P3 releases its R4 at t=9 (finishing), giving P1 the 2 units it needs by t=9 — P1 then finishes too. Every resource-count is conserved throughout (verified per resource type), and all three processes complete: no permanent deadlock occurs, only temporary blocking that resolves via later releases.

Source: GATE CS 2009 (2009)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free