CS FundamentalsHardCapgemini · Cognizant GenC

Banker's algorithm: Available = (3, 3, 2). Allocation / Max for (A, B, C): P0 (0,1,0)/(7,5,3), P1 (2,0,0)/(3,2,2), P2 (3,0,2)/(9,0,2), P3 (2,1,1)/(2,2,2), P4 (0,0,2)/(4,3,3). Which of the following is a safe sequence?

  1. A. P0, P1, P2, P3, P4
  2. B. P2, P1, P3, P4, P0
  3. C. P4, P3, P2, P1, P0
  4. D. P1, P3, P4, P0, P2

Correct answer: D. P1, P3, P4, P0, P2

Need = Max - Allocation. P1 needs (1,2,2) <= (3,3,2); then Available (5,3,2); P3 needs (0,1,1); then (7,4,3); P4 needs (4,3,1); then (7,4,5); P0 needs (7,4,3); then (7,5,5); P2 needs (6,0,0). P0 first fails since (7,4,3) > (3,3,2); P2 first fails; P4 first fails.

More Operating Systems questions

Exams that ask this topic