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.

36 Time Management Chapter 2How well does FCFS work? Long processes love it, and short ones hate it. To seewhy, assume that four processes enter the ready list at almost the same time. Theyrequire 1, 100, 1, and 100 seconds, respectively. Here is how the measures come out:Process Arrival Service Start FinishT M Pname time required time time A 0 1 0 1 1 0 1.00 B 0 100 1 101 101 1 1.01 C 0 1 101 102 102 101 102.00 D 0 100 102 202 202 102 2.02Mean 101.5 51.0 28.1The penalty ratio P for process C is indefensible. <strong>An</strong>y short process caught behind along one will suffer a wait time much longer than the time it really needs to execute.Long processes, in contrast, will generally receive reasonable values for P , even if theyhave to wait behind a few other processes. Process D had to wait but still got a prettygood penalty ratio.The penalty ratio for FCFS, as seen in Figure 2.4, is very bad for short processes.One third of all processes have a penalty ratio worse than 10. The upper 10 percent of allprocesses, however, find FCFS has an excellent penalty ratio (less than 2.5).The amount of missed time under FCFS is fairly equitable, as seen in Figure 2.6.All classes of processes had about the same missed time: 4 seconds. This result stands toreason. The amount of missed time for some process depends on the processes ahead ofit in the ready list and is independent of the amount of service the process itself needs.Given our assumptions that both arrival and service time fit an exponential distribution,we can express the behavior of the first come, first served scheduling policyanalytically, without resorting to simulation.M () = ρ T (t ) = t + ρ P (t ) = 1+ ρβ(1−ρ) β(1−ρ) t β(1−ρ)These formulas represent averages, and only hold for the steady state. The first formulapredicts our simulated result that M = 4, independent of t . The third formula predicts ourresult that the penalty ratio is high for short processes and low for long processes.What if ρ > 1? FCFS eventually services every process, although the missed timegets longer and longer as ρ remains above 1. (Actually, ρ cannot remain higher than 1for very long, since the rate at which processes arrive at the short-term scheduler dependsto some extent on the rate at which they leave. We do not actually have an infinite populationof processes.) We will see that some other methods do not guarantee eventual service.The situation in which a process is ready to run but never gets any service is calledstarvation. Starvation while waiting for other resources besides time is discussed inChapters 4 and 8.

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

Saved successfully!

Ooh no, something went wrong!