The GATE Grind

GATE 2013 CS (CS1) – Question 26

Operating System · Deadlock · 1 mark · Multiple choice

Binary semaphores a,b,c,d start at one. X needs a,b,c; Y needs b,c,d; Z needs c,d,a, releasing all after its code. Which acquisition order is deadlock-free?

  1. X:abc; Y:bcd; Z:cda
  2. X:bac; Y:bcd; Z:acd
  3. X:bac; Y:cbd; Z:acd
  4. X:abc; Y:cbd; Z:cda

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) X:bac; Y:bcd; Z:acd

Explanation

Option B follows one global resource order b<a<c<d: X acquires b,a,c; Y b,c,d; Z a,c,d. A circular wait is impossible when every process acquires resources in increasing global order. Thus B is deadlock-free; the other options admit inconsistent ordering cycles.

More Deadlock questions

All Deadlock questions →