CS FundamentalsVery hardGATE CS

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

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

Correct answer: D. P1 requests (1, 2, 1)

Needs are P0 (4,2,2), P1 (1,2,1), P2 (4,0,1), P3 (1,1,2), P4 (4,3,1). Granting P1's full need leaves (1,0,0) but P1 can finish, giving (4,2,2), then P2, P3, P4, P0 follow. Each other request leaves an available vector no process's need fits, so it is unsafe.

More Operating Systems questions

Exams that ask this topic