The GATE Grind

GATE 2014 CS (CS1) – Question 41

Operating System · Deadlock · 2 marks · Multiple choice

Banker’s algorithm manages resource types X,Y,Z for P₀,P₁,P₂. Current allocation vectors are P₀:(0,0,1), P₁:(3,2,0), P₂:(2,1,1); maximum vectors are P₀:(8,4,3), P₁:(6,2,0), P₂:(3,3,3). Available = (3,2,2); current state is safe. Consider independently REQ1: P₀ requests (0,0,2); REQ2: P₁ requests (2,0,0). Which is TRUE?

  1. Only REQ1 permitted
  2. Only REQ2 permitted
  3. Both permitted
  4. Neither permitted

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) Only REQ2 permitted

Explanation

Initial needs are P₀(8,4,2),P₁(3,0,0),P₂(1,2,2). Granting REQ1 leaves available(3,2,0), allowing P₁ to finish but then neither remaining process can obtain its missing Z resource, so it is unsafe. Granting REQ2 leaves(1,2,2); P₁ can finish and release(5,2,0), then P₂ and P₀ finish. Thus **only REQ2,B**.