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.
| 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?
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.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development