CS FundamentalsVery hardGATE CS (PYQ pattern)

Banker's algorithm with 3 resource types. Allocation: P0 (1,0,0), P1 (1,2,0), P2 (0,0,0), P3 (1,4,3), P4 (3,1,1). Maximum: P0 (5,3,2), P1 (5,6,1), P2 (4,1,2), P3 (3,6,5), P4 (5,2,1). Available = (2,3,3). Two requests arrive, each to be judged separately against this state: R1 = P3 asks (2,0,2); R2 = P0 asks (1,0,0). Both are within the process's declared maximum. Which request(s) can be granted immediately while keeping the system safe?

  1. A. R1 only
  2. B. R2 only
  3. C. Both R1 and R2
  4. D. Neither R1 nor R2

Correct answer: A. R1 only

Pretend to grant each request, subtract it from Available and Need, and run the safety algorithm. R1 leaves a safe state; R2 can be satisfied from Available but leads to a state with no safe sequence, so it must wait.

More Operating Systems questions

Exams that ask this topic