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.
| Allocation | Max | |||||
|---|---|---|---|---|---|---|
| E | F | G | E | F | G | |
| P0 | 1 | 0 | 1 | 4 | 3 | 1 |
| P1 | 1 | 1 | 2 | 2 | 1 | 4 |
| P2 | 1 | 0 | 3 | 1 | 3 | 3 |
| P3 | 2 | 0 | 0 | 5 | 4 | 1 |
From the perspective of deadlock avoidance, which one of the following is true?
GATE CS - 2018,
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:
- P0 needs (3, 3, 0), which is available. It finishes and releases (1, 0, 1): available becomes (4, 3, 1).
- P2 needs (0, 3, 0). It finishes and releases (1, 0, 3): available becomes (5, 3, 4).
- P1 needs (1, 0, 2). It finishes and releases (1, 1, 2): available becomes (6, 4, 6).
- 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.
Please log in or register to report this question.