Machine-translated by Google. Questions are authored in English.
Top

Discussion

Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available.

AllocationMax
EFGEFG
P0101431
P1112214
P2103133
P3200541

From the perspective of deadlock avoidance, which one of the following is true?

  • A.The system is in safe state.
  • B.The system is not in safe state, but would be safe if one more instance of E were available
  • C.The system is not in safe state, but would be safe if one more instance of F were available
  • D.The system is not in safe state, but would be safe if one more instance of G were available

Answer: A

The system is in a safe state.

Need = Max − Allocation gives P0 (3, 3, 0), P1 (1, 0, 2), P2 (0, 3, 0) and P3 (3, 4, 1), with (3, 3, 0) available. The banker's safety check finds an order in which every process can finish:

  1. P0 needs (3, 3, 0), which is available. It finishes and releases (1, 0, 1): available becomes (4, 3, 1).
  2. P2 needs (0, 3, 0). It finishes and releases (1, 0, 3): available becomes (5, 3, 4).
  3. P1 needs (1, 0, 2). It finishes and releases (1, 1, 2): available becomes (6, 4, 6).
  4. P3 needs (3, 4, 1). It finishes.

The safe sequence P0, P2, P1, P3 exists, so the state is safe and none of the options claiming it is unsafe can be right, whichever extra resource they add.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.