6] OPERATING SYSTEMS 113
Requests
P CD Plot
P0 0 0 0
P1 2 0 2
P2 0 0 0
P3 1 0 0
P4 0 0 2
Requests
P CD Plot
P0 0 0 0
P1 2 0 2
P2 0 0 1
P3 1 0 0
P4 0 0 2
P0 can still proceed as in our earlier analysis, and when it completes it will return one CD ROM drive. Then
Available = [0, 1, 0]. Unfortunately, there is no way to satisfy the requests of any other process, and
P1, P2, P3, and P4 are deadlocked.
Deadlock recovery
Once the system detects a deadlock, the next question is what to do about it. Some resource could be preempted
from one of the processes, but the operating system probably will not know the consequences of such an action.
One of the processes could be terminated, but again the consequences will probably be unknown. What if the
deadlocked process had just withdrawn $1000 from a savings account, and was now blocked as it attempted to deposit
that money in a checking account? One wouldn??™t want to terminate the process; nor would one want to restart it.
An exception might be if one of the processes were a compiler or some other process whose computation
could be restarted from the beginning. Since such a process could be safely restarted, it could be terminated in
order to free resources.
Pages:
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309