CS FundamentalsVery hardGATE CS

Banker's algorithm, resources (A, B, C). Available = (1, 1, 2). Allocation / Max: P0 (1,0,1)/(2,1,2), P1 (2,1,0)/(3,2,2), P2 (0,1,1)/(1,2,3), P3 (1,0,0)/(3,1,2). How many of the 24 orderings of P0-P3 are safe sequences?

  1. A. 18
  2. B. 6
  3. C. 12
  4. D. 16

Correct answer: D. 16

Needs are (1,1,1), (1,1,2), (1,1,2), (2,1,2). P3 cannot go first, but P0, P1 or P2 can; after P0 or P1 everything else fits in any order (2 × 6 = 12). After P2 alone the pool is (1,2,3), still short for P3, so of its 6 orders the 2 with P3 second fail: 12 + 4 = 16.

More Operating Systems questions

Exams that ask this topic