Deadlock Detection: allow the system to enter a deadlock
state and then recover.
· Requires deadlock detection algorithm
· Technique for forcibly preempting resources and/or terminating tasks
1. ) ALLOW SYSTEM TO ENTER DEADLOCK STATE
2. ) DETECTION ALGORITHM
1. Let Work and Finish be vectors of length m and n, respectively
Initialize:
(a) Work = Available
(b) For i = 1,2, …, n, if Allocationi ≠ 0,then
Finish[i] = false;otherwise, Finish[i] = true.
2. Find an index i such that both:
(a) Finish[i] == false
(b) Requesti
≤ Work
If no such i exists, go to step 4.
3. Work = Work + Allocationi
Finish[i] = true
go to step 2.
4. If Finish[i] == false, for some i, 1 ≤ i ≤ n, then the system is in deadlock
state. Moreover, if Finish[i] == false, then Pi
is deadlocked.
Algorithm requires an order of O(m x n2) operations to detect whether
the system is in deadlocked state.
3.) RECOVERY SCHEME
0 comments:
Post a Comment