CS FundamentalsHardProduct-company MCQ pattern

Five processes P0–P4 and three resource types A, B, C. Allocation: P0 (1,0,1), P1 (2,1,1), P2 (0,1,2), P3 (1,1,0), P4 (0,0,2). Max: P0 (4,2,3), P1 (3,2,2), P2 (2,3,4), P3 (3,1,2), P4 (1,2,3). Available: (1,1,1). P4 now requests (0, 0, 1). What should the Banker's algorithm do?

  1. A. Make P4 wait, because the resulting state would be unsafe
  2. B. Grant it, and the safe sequence becomes P4, P1, P3, P0, P2
  3. C. Grant it, since the request ≤ Need and ≤ Available
  4. D. Abort P4, because the request exceeds its maximum claim

Correct answer: A. Make P4 wait, because the resulting state would be unsafe

The request passes both checks (≤ Need (1,2,1), ≤ Available (1,1,1)). Pretending to grant it: Available = (1,1,0), P4's need = (1,2,0). Now P1 needs (1,1,1), but C = 0, and nobody else fits either, so the state is unsafe and P4 must wait. Passing the two checks is not enough.

More Operating Systems questions

Exams that ask this topic