Correct option is A
First, calculate the Need Matrix using:
Need = Maximum - Allocation
Need Matrix
| Process | R1 | R2 | R3 |
| P1 | 7 | 4 | 3 |
| P2 | 1 | 2 | 2 |
| P3 | 6 | 0 | 0 |
| P4 | 0 | 1 | 1 |
Initial Available Resources = (3, 2, 1)
Now check which process can execute:
- P1: Needs (7,4,3) → Cannot execute
- P2: Needs (1,2,2) → Cannot execute because R3 needed = 2 but available = 1
- P3: Needs (6,0,0) → Cannot execute because R1 needed = 6 but available = 3
- P4: Needs (0,1,1) → Can execute
After executing P4, resources released:
Available = (3,2,1) + (2,1,1) = (5,3,2)
Now check remaining processes:
- P1: Needs (7,4,3) → Cannot execute
- P2: Needs (1,2,2) → Can execute
After executing P2:
Available = (5,3,2) + (2,0,0) = (7,3,2)
Now:
- P3: Needs (6,0,0) → Can execute
After executing P3:
Available = (7,3,2) + (3,0,2) = (10,3,4)
Now:
- P1: Needs (7,4,3) → Cannot execute because R2 needed = 4 but available = 3
Thus, all processes cannot complete successfully, so the system is in an unsafe state and no complete safe sequence exists.
Therefore, the number of safe sequences possible is 0.
Important Key Points:
- Banker’s Algorithm is used for deadlock avoidance.
- The Need Matrix is calculated as:
Need = Maximum - Allocation - A process can execute only if its need is less than or equal to available resources.
- If all processes cannot complete, the system is in an unsafe state.
Knowledge Booster:
- (b) 1: Incorrect because no complete safe sequence exists for all processes.
- (c) 2: Incorrect because the system cannot generate even one full safe sequence.
- (d) 3: Incorrect because the resource allocation state is unsafe.
- (e) 4: Incorrect because all processes cannot complete successfully under current available resources.