13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

132 Resource Deadlock Chapter 412534Figure 4.9 One-shot allocationthem is not yet using them. Furthermore, a process may not know all the resources it willeventually need.5 HIERARCHICAL ALLOCATION<strong>An</strong>other way to prevent a cycle is to associate some number with each process andsomehow make sure that numbers only increase as we follow any chain of waitingprocesses. There clearly can’t be a cycle of processes, each of which has a highernumber than the previous one.That is the theory, but how can it be made practical? First, give each resourceclass a ‘‘level’’ number. For example, tape drives can have level 1, plotters 2, andprinters 3. The numbers need not all be different. We will associate each process withthe number of the highest level resource it currently holds. To make sure the numbersincrease on any chain of waiting processes, we impose the following rule.Hierarchical allocationA process may request resources only at a higher levelthan any resource it currently holds.For example, if process A has a tape drive and a plotter, it can ask for two printers, but itmay not request another tape drive or another three plotters. A process that only has atape drive may ask for both plotters and printers but not for another tape drive. This rule

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!