CS FundamentalsVery hardGATE CS (PYQ pattern)

Six processes share identical units of one resource; each needs at most 4 units. Five of them request units one at a time, holding what they have while waiting. The sixth process requests all 4 of its units in a single atomic request (granted only when 4 units are free) and holds nothing before that. What is the minimum number of units that makes deadlock impossible?

  1. A. 19
  2. B. 15
  3. C. 16
  4. D. 18

Correct answer: C. 16

A deadlock needs every unfinished process blocked. The one-at-a-time processes block only when 0 units are free, and the atomic process never holds anything while waiting, so the worst case is the five others holding 3 each with nothing free: 15 units deadlock. With 16, one unit is always free when the five hold at most 15, so some process can finish. The formula 6 x (4 - 1) + 1 = 19 wrongly assumes the sixth process can also sit on 3 units.

More Operating Systems questions

Exams that ask this topic