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.

Policies 41simulation results, show that the penalty ratio and missed time for SPN are better than forRR, except for the shortest 15 percent of all processes, where the figures are still farbetter than for FCFS.2.4 Preemptive shortest process next (PSPN)We saw that RR achieves a good penalty ratio by using preemption, and that SPN doeseven better by using extra information about each process. We would expect to do stillbetter by combining these techniques. The PSPN preempts the current process whenanother process arrives with a total service time requirement less than the remaining servicetime required by the current process. The value of T (t ) turns out to be lower thanfor SPN for all but the longest 10 percent of all processes in our simulation of Figure 2.4.Our five-process example behaves the same under SPN and PSPN; there is neverany preemption because short processes do not arrive near the start of execution of longprocesses. Figures 2.4 and 2.6 show that for all but the longest 7 percent of all processes,PSPN is better than SPN. It has an excellent penalty ratio, and the missed time stays verylow for a large majority of processes. Even for very long processes, PSPN is not muchworse than RR. In fact, PSPN gives the best achievable average penalty ratio because itkeeps the ready list as short as possible. It manages this feat by directing resourcestoward the process that will finish soonest, and will therefore shorten the ready listsoonest. A short ready list means reduced contention, which leads to a low penalty ratio.2.5 Highest penalty ratio next (HPRN)Non-preemptive scheduling policies seem to give unfair advantage either to very longprocesses (FCFS) or to very short ones (SPN). The HPRN method tries to be fairer andstill not introduce preemption. As a new process waits in the ready list, its value of P ,which starts at 1, begins to rise. After it has waited w time on the ready list,P = (w +t )/t . When an old process departs, the ready process with the highest penaltyratio is selected for execution. As long as the saturation is not unreasonable (ρ < 1), theHPRN method will not starve even very long processes, since eventually their penaltyratio reaches a high value.If t is not known, it can be estimated by an exponential average of service timesduring previous compute bursts, as we discussed earlier. Alternatively, we can base theHPRN method on a medium-term penalty ratio, which is (M +t )/t , where M is the totaltime missed while the process has languished either on the short-term ready list or on amedium-term main-store wait list (but not on a transput-wait list) and t is the total cputime used during previous compute bursts.HPRN strikes a nice balance between FCFS and SPN. If we use the actual value oft , our sample process set behaves the same under HPRN and FCFS. Our simulation,reported in Figures 2.4 and 2.6, also used the actual value of t . HPRN fits neatlybetween FCFS and SPN, for short processes, where HPRN is much like SPN; for

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

Saved successfully!

Ooh no, something went wrong!