In: Computer Science
Deadlock Avoidance using Banker’s Algorithm
Q2: Use the following information and complete the Table, also write down the safe sequence if exist?
Three Resources (R1=4, R2=9, R3=11)
Processes |
Allocated Resources R1 R2 R3 |
Maximum Required Resources R1 R2 R3 |
Currently Available Resources R1 R2 R3 |
Remaining Need R1 R2 R3 |
Safe Sequence |
P1 |
1 4 2 |
2 4 6 |
|||
P2 |
2 1 1 |
3 2 8 |
|||
P3 |
0 0 1 |
1 2 3 |
|||
P4 |
0 0 0 |
4 4 2 |
|||
P5 |
0 0 1 |
1 3 1 |
yes there are exist safe sequence and the safe sequence is P1->P2->P3->P4->P5
process | allocated reso | max require | cur availabe | remaining need | SAFE SEQUENCE |
P1 | 1 4 2 | 2 4 6 | 1 4 6 | 1 0 4 | FIRST |
P2 | 2 1 1 | 3 2 8 | 2 8 8 | 1 1 7 | SECOND |
P3 | 0 0 1 | 1 2 3 | 4 9 9 | 1 2 2 | THIRD |
P4 | 0 0 0 | 4 4 2 | 4 9 10 | 4 4 2 | FOURTH |
P5 | 0 0 1 | 1 3 1 | 4 9 11 | 1 3 2 | FIVETH |