13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Page-replacement policies 105Min, our next method, suffers fewer page faults than any other method. Unfortunately, itcannot be implemented. We use it as a yardstick for comparison with other methods. Noimplementable method will have as few page faults, but we can see how close they cometo the unobtainable optimum.The Min method follows a simple rule:MinSelect the page frame containing the page whose nextaccess will be farthest in the future.This choice delays the next page fault as long as possible. Of course, no storage managerknows when each page will be accessed next, so the method cannot be implemented.The curve for Min, the lowest in Figure 3.20, shows that it is better than the othermethods.Looking at the curves for Random and Min, one might be led to the conclusion thatthere is little benefit to be gained by complex page-replacement strategies. After all, nomatter how effective a strategy might be, it cannot beat Min, and any method ought to doat least as well as Random. The region for improvement is not particularly large. Thecharacteristic numbers range only over a factor of 2 (from about 60,000 to about115,000). At a main-store size of 20 page frames, the number of page faults ranges overa factor of 3 (from about 650 to about 1950). The number of page frames needed to keepthe number of page faults to 1000 — a 10% rate — ranges over less than a factor of 2(from 17 to 29).However, factors of 2 and 3 can make a large difference to the behavior of theoperating system. Improving the fault rate increases the sustainable level of multiprogrammingby the same factor. Programs that cannot execute without thrashing can onlybe served by increasing the size of physical store or by improving the fault rate. A programexhibiting the page-reference string pictured in the graph would manage acceptably(1 percent fault rate) with 39 page frames under Min but would need 56 page framesunder Random. In addition, this single graph is not representative of all page-referencestrings that occur in practice. The gap between Min and Random could be much greaterfor some programs.Figure 3.21 shows the same information as Figure 3.20, except that the curve forMin has been subtracted from the other three curves. We see from this figure that thepage-fault rate of Random is particularly poor in comparison to Min when main store islimited. When storage is extremely limited (fewer than 5 page frames, in our example),all our methods do equally poorly in comparison with Min. When storage is plentiful(more than 50 page frames, in our example), even Random does fairly well. In the intermediaterange, we can hope for significant improvements over Random. The FIFO andLRU methods, which we will now discuss, justify that hope.7.3 First in, first out (FIFO)

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

Saved successfully!

Ooh no, something went wrong!