CS FundamentalsVery hardGATE CS

Banker's algorithm, resources (A, B, C). Allocation / Max: P0 (1,0,1) / (4,3,2), P1 (2,1,0) / (3,2,2), P2 (0,1,1) / (2,3,3), P3 (1,1,0) / (1,4,1), P4 (0,0,2) / (2,1,3). Available = (1, 3, 1). Which single request can be granted immediately?

  1. A. P0 requests (1, 1, 0)
  2. B. P1 requests (1, 0, 1)
  3. C. P3 requests (0, 2, 0)
  4. D. P4 requests (1, 0, 1)

Correct answer: C. P3 requests (0, 2, 0)

Granting P3 (0,2,0) leaves (1,1,1); P3's remaining need (0,1,1) fits, and P3, P4, P1, P2, P0 then finish in turn, so it is safe. The other three requests fit in Available, but after granting each no process can finish: the resulting state is unsafe.

More Operating Systems questions

Exams that ask this topic