Suppose this is the matrix Requests for the same set of five processes at a particular instant:
With this information, the system can determine whether deadlock has occurred. All it needs to do is determine
whether there is some way all processes can have their requests met, and then continue to execute. If there is
some way all processes can complete, then there is no deadlock.
In this case, no resources are available; all resources are already allocated. However, P0 and P2 are
not requesting any more resources. Suppose P0 and P2 run to completion; P0 will release one CD-ROM drive,
and P2 will release three printers and three plotters. At that point Available = [3, 1, 3]. Now the
requests of P1 for two more printers and two more plotters can be satisfied; P1 can complete; and P1 can return
the two printers it already has, plus the two more it requested. Now Available = [5, 1, 3]. It??™s obvious
that similar reasoning shows that the requests of the remaining processes can be satisfied, and therefore there is
no deadlock at this time.
Suppose, however, that one small change is made to the matrix Requests. Suppose that P2 has a pending
request for one plotter. Now the matrix Requests looks like this:
Allocated
P CD Plot
P0 0 1 0
P1 2 0 0
P2 3 0 3
P2 2 1 1
P2 0 0 2
CHAP.
Pages:
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308