CS FundamentalsVery hardGATE CS

Resources A, B, C, D. Available = (1,5,2,0). Allocation: P0 (0,0,1,2), P1 (1,0,0,0), P2 (1,3,5,4), P3 (0,6,3,2), P4 (0,0,1,4). Max: P0 (0,0,1,2), P1 (1,7,5,0), P2 (2,3,5,6), P3 (0,6,5,2), P4 (0,6,5,6). Is the state safe, and can P1's request (0,4,2,0) be granted immediately?

  1. A. Unsafe; the request can be granted
  2. B. Safe; the request can be granted
  3. C. Safe; the request cannot be granted
  4. D. Unsafe; the request cannot be granted

Correct answer: B. Safe; the request can be granted

Need: P0 (0,0,0,0), P1 (0,7,5,0), P2 (1,0,0,2), P3 (0,0,2,0), P4 (0,6,4,2). A safe sequence is P0, P2, P1, P3, P4. After granting P1 (0,4,2,0), Available = (1,1,0,0); P0 (need 0) can finish, then the others in some order, so the new state is still safe.

More Operating Systems questions

Exams that ask this topic