Deadlocks Slides
Deadlocks Slides
Deadlocks
Shankar
1. Deadlocks Overview
2. Deadlock Prevention
3. Deadlock Avoidance
1. Deadlocks Overview
2. Deadlock Prevention
3. Deadlock Avoidance
1. Deadlocks Overview
2. Deadlock Prevention
3. Deadlock Avoidance
Deadlock avoidance:
Processes: 1, · · · ,N
Maxi : [Maxi,1 , · · · Maxi,M ] // max total need of process i
Variables
needi1 ≤ avail
needi2 ≤ avail + alloci1
...
neediN ≤ avail + alloci1 + · · · + allociN−1
Variables
xavail ← avail // temporary avail
done[i] ← false, for i = 1, · · · , N // true i i accounted for
Tot : [10 5 7]
State
Max alloc
P1 7 5 3 0 1 0
P2 3 2 2 2 0 0
P3 9 0 2 3 0 2
P4 2 2 2 2 1 1
P5 4 3 3 0 0 2
Safe?
Banker's Algorithm Example avoidance
Tot : [10 5 7]
State
Safe?
Banker's Algorithm Example avoidance
Tot : [10 5 7]
State
Safe?
Banker's Algorithm Example avoidance
Tot : [10 5 7]
State
1. Deadlocks Overview
2. Deadlock Prevention
3. Deadlock Avoidance
Variables
xavail ← avail // temporary avail
done[i] ← false, for i = 1, · · · , N // true i i accounted for
1. Deadlocks Overview
2. Deadlock Prevention
3. Deadlock Avoidance