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.

166 Transput Chapter 5on the way out.To illustrate these disk-scheduling algorithms, let us consider a disk with 200cylinders (a typical number). Let’s assume that at a given instant, the read/write head issitting at cylinder 100. Transfers to or from the following cylinders have been requested.The requests are listed in the order in which they arrived. It is irrelevant whether they areread or write requests.23 89 132 42 187 165 21 34 101 102 34 2 167 3 34 199 20We will assume that no new requests arrive while we service this set. (By the way, it isquite unusual for more than three or four requests to be outstanding in a well-tunedoperating system.) The algorithms we have seen have the following behavior.Requests 23 89 132 42 187 165 21 34 101 102 34 2 167 3 34 199 20 motion FCFS 23 89 132 42 187 165 21 34 101 102 34 2 167 3 34 199 20 1472 Pickup 89 42 34 34 34 23 101 102 132 165 167 187 21 20 3 2 199 623 SSF 101 102 89 132 165 167 187 199 42 34 34 34 23 21 20 3 2 322 Look 101 102 132 165 167 187 199 89 42 34 34 34 23 21 20 3 2 296 C-Look 101 102 132 165 167 187 199 2 3 20 21 23 34 34 34 42 89 383 The SSF and Look methods have similar results, but if requests had continued to arriveduring the time others were serviced, it is likely that SSF would have turned back to pickup some new requests close to its current position. Look turns back only when there isno further work in the current direction. As expected, FCFS has the worst behavior.To compare these methods further, we turn to simulation results. The simulateddisk has 200 tracks. Seek latency is (0.5 + 0.4 . Distance ) milliseconds if the distance isat least one track and zero otherwise. (The 0.5 term represents time needed just to startand stop the head.) There are 20 sectors per track. The disk spins at 3600 revolutionsper minute. Rotational latency depends on when the head arrives at the track and the sectorthat is needed. The simulation compares the behavior of the five policies on a workloadof 1000 requests, with interarrival time selected from an exponential distribution.The average arrival rate is allowed to vary between 5 and 100 arrivals per second. Boththe track and the sector needed by each request are selected from a uniform distribution.(Very similar results were obtained from using a normal distribution for tracks, withaverage value 100 and standard deviation 100.)Figure 5.9 shows the average time for a disk request to be serviced for the differentmethods across the given workloads. The FCFS method is clearly terrible. The othermethods are not particularly easy to distinguish. Surprisingly, C-Look did not perform aswell as Look, even with high arrival rate. (It did perform slightly better than Look withrequested tracks selected from a normal distribution.) Figure 5.10 shows the throughput— that is, the number of requests served per second — for the five methods. This figureshows even more clearly that FCFS is by far the worst but that all the other methods areessentially indistinguishable. If the arrival rate is less than 22 requests per second, FCFSmanages just as well as the others with respect to throughput, although its response timestarts falling behind the others at about 10 requests per second.

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

Saved successfully!

Ooh no, something went wrong!