Deadlock Avoidance Banker
Deadlock Avoidance Banker
Safe sequence
Total A=10, B=5, C=7
Unsafe
CPU Printer
Memory
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C
1 0 1 0 7 5 3 3 3 2
2 2 0 0 3 2 2
3 3 0 2 9 0 2
4 2 1 1 4 2 2
5 0 0 2 5 3 3
Total 7 2 5
Safe sequence
Total A=10, B=5, C=7
Unsafe
CPU Printer
Memory
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C
1 0 1 0 7 5 3 3 3 2 7 4 3
2 2 0 0 3 2 2 1 2 2
3 3 0 2 9 0 2 6 0 0
4 2 1 1 4 2 2 2 1 1
5 0 0 2 5 3 3 5 3 1
Total 7 2 5
CPU Printer
Safe sequence
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Here, Compare remaining
Resouces A B C A B C A B C A B C Need withcurrent availability ,
1 0 1 0 7 5 3 3 3 2 7 4 3 of P1. P1 cannot execute
because it not fullfill all
2 2 0 0 3 2 2 1 2 2
instance of current availability
3 3 0 2 9 0 2 6 0 0
4 2 1 1 4 2 2 2 1 1 Check P2 it can execute
5 0 0 2 5 3 3 5 3 1 because it fullfill all instance of
current availability , it will
Total 7 2 5 come in safe sequence
list.After it execution it release
Total A=10, B=5, C=7 already allocated resources
too.
CPU Printer
Safe sequence P2,
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C Here, P1 cannot execute
1 0 1 0 7 5 3 3 3 2 7 4 3 because it not fullfill all
instance of current availability
2 2 0 0 3 2 2 5 3 2 1 2 2
3 3 0 2 9 0 2 6 0 0 Check P2 it can execute
because it fullfill all instance of
4 2 1 1 4 2 2 2 1 1
current availability , it will
5 0 0 2 5 3 3 5 3 1 come in safe sequence
Total 7 2 5 list.After it execution it release
already allocated resources
too.
Total A=10, B=5, C=7
Now add P2 allocated in current availability and update it
CPU Printer
Safe sequence P2,
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C Check P3 it cannot execute
because it inot fullfill all
1 0 1 0 7 5 3 3 3 2 7 4 3
instance of current availability
2 2 0 0 3 2 2 5 3 2
3 3 0 2 9 0 2 6 0 0
4 2 1 1 4 2 2 2 1 1
5 0 0 2 5 3 3 5 3 1
Total 7 2 5
CPU Printer
Safe sequence P2,
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C
1 0 1 0 7 5 3 3 3 2 7 4 3 Check P4 it can execute
because it fullfill all instance of
2 2 0 0 3 2 2 5 3 2
current availability , it will
3 3 0 2 9 0 2 7 4 3 6 0 0 come in safe sequence
4 2 1 1 4 2 2 2 1 1 list.After it execution it release
already allocated resources
5 0 0 2 5 3 3 5 3 1 too.
Total 7 2 5
CPU Printer
Safe sequence P2,P4
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C
1 0 1 0 7 5 3 3 3 2 7 4 3 Check P5 it can execute
because it fullfill all instance of
2 2 0 0 3 2 2 5 3 2
current availability , it will
3 3 0 2 9 0 2 7 4 3 6 0 0 come in safe sequence
4 2 1 1 4 2 2 7 4 5 list.After it execution it release
already allocated resources
5 0 0 2 5 3 3 5 3 1 too.
Total 7 2 5
CPU Printer
Safe sequence P2,P4, P5
Memory
Unsafe
Deadlock Avoidance Banker's Algorithm
Current availability
Process Allocation Max Need Available Remaining Need
Resouces A B C A B C A B C A B C
1 0 1 0 7 5 3 3 3 2 7 4 3 NowCheck P1 it can execute
now because it fullfill all
2 2 0 0 3 2 2 5 3 2
instance of current
3 3 0 2 9 0 2 7 4 3 6 0 0 availability , it will come in
4 2 1 1 4 2 2 7 4 5 safe sequence list.After it
execution it release already
5 0 0 2 5 3 3 allocated resources too.
Total 7 2 5