CS FundamentalsVery hardGATE CS

Banker's algorithm state: Available = (3,3,2). Allocation: P0 (0,1,0), P1 (2,0,0), P2 (3,0,2), P3 (2,1,1), P4 (0,0,2). Max: P0 (7,5,3), P1 (3,2,2), P2 (9,0,2), P3 (2,2,2), P4 (4,3,3). Considered separately (each against this same state), what happens to the requests P4 → (3,3,0), P0 → (0,2,0) and P1 → (1,0,2)?

  1. A. P4: denied (unsafe); P0: granted; P1: granted
  2. B. All three can be granted
  3. C. P4: denied (unsafe); P0: denied (unsafe); P1: granted
  4. D. P4: must wait (exceeds Available); P0: granted; P1: granted

Correct answer: A. P4: denied (unsafe); P0: granted; P1: granted

P4's (3,3,0) is within its need (4,3,1) and within Available, but it would leave Available (0,0,2), enough for nobody: unsafe, so denied. P0's (0,2,0) leaves (3,1,2): P3 (need 0,1,1) can finish, then P1, P0, P2, P4, so it is safe and granted. P1's (1,0,2) leaves (2,3,0) and P1, P3, P4, P0, P2 is safe. (The well-known denial of P0's request happens only AFTER P1's request has been granted.)

More Operating Systems questions

Exams that ask this topic