CS FundamentalsVery hardGATE CS (PYQ pattern)

Banker's algorithm with two resource types (R1, R2). Allocation: P0 (0,2), P1 (1,4), P2 (0,4), P3 (6,1), P4 (0,2). Maximum: P0 (1,4), P1 (4,7), P2 (7,4), P3 (6,5), P4 (1,3). Available = (0,0). The current state is unsafe. What is the minimum number of extra units of R2 (R1 unchanged) that must be added to Available to make the state safe?

  1. A. 4
  2. B. 5
  3. C. 3
  4. D. 7

Correct answer: A. 4

Compute Need = Max - Allocation and run the safety algorithm with Available R2 increased by 0, 1, 2, ...: the first value that lets all five processes finish is 4.

More Operating Systems questions

Exams that ask this topic