g., low CPU utilization), to determine if a deadlock exists. Such a routine will inspect the
resources allocated to each process, and examine all the pending requests by processes for additional resources.
112 OPERATING SYSTEMS [CHAP. 6
If there is some way for all processes to have their pending requests satisfied and run to completion, then deadlock
does not exist. Otherwise, deadlock does exist, and some action must be taken to break the deadlock.
The deadlock detection algorithm works by maintaining several data structures. First, the algorithm maintains
a vector with the count of available resources of each type. This vector is called Available. If a system has
seven printers, two CD-ROM drives, and six plotters, and all devices are allocated to one or another process
(none is available), then the vector
Available = [0, 0, 0]
A matrix called Allocated records the counts of resources of each type already allocated to each active
process. In a particular case of five active processes, where all of the resources listed in the previous paragraph
have been allocated, the matrix Allocated might look like this:
A matrix called Requests maintains the counts of all pending resource requests, at this particular moment,
by each process.
Pages:
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307