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.

Device drivers 165impose an order on the outstanding disk requests so that they can be servedefficiently.We will direct our attention to this last strategy, which is known as disk-head scheduling.In general, disk-head scheduling makes the following assumptions:There is only one disk drive. If there are several, each is scheduled independently.All requests are for single, equal-sized blocks.Requested blocks are randomly distributed on the disk pack.The disk drive has only one movable arm, and all read/write heads are attached tothat one arm.Seek latency is linear in the number of tracks crossed. (This assumption fails if thedisk controller has mapped tracks at the end of the disk to replace ones that havebad sectors.)The disk controller does not introduce any appreciable delays.Read and write requests take identical time to service.We will evaluate various policies by describing how long requests have to wait as a functionof the load. Both the average wait time and the variance of the wait time are important.A low average with a high variance means that some requests are taking a very longtime even though most are served quickly. The load is measured in requests per second.We could also use the length of the outstanding-request list.The simplest policy is to order disk requests on a first-come, first-served (FCFS)basis. FCFS makes sure that every request is eventually served; there is no starvation.However, every request is likely to suffer a seek operation. This method works fine forvery low loads, but it saturates quickly — that is, the load doesn’t have to grow verylarge before the disk can no longer keep up with the work. The variance of the meanwait time is fairly low.FCFS disk-head scheduling and its refinements once again illustrate the Law ofDiminishing Returns, which we first saw in Chapter 1. There are many alternatives toFCFS, and they are all much better. For example, the Pickup method keeps the requestsin FCFS order to prevent starvation, but on its way to the track where the next requestlies, it ‘‘picks up’’ any requests that can be serviced along the way.<strong>An</strong>other alternative policy is Shortest Seek-latency First (SSF), which next servesthe request whose track is closest to the current one. This policy does allow starvation,but if a request is consistently bypassed, the disk must be incapable of keeping up withthe disk requests in any case. This kind of starvation is not as bad as the underlyingproblem, which is very likely that the main-store allocation policy is causing thrashing.SSF has the advantage of minimizing the total seek latency and saturating at the highestload of any policy. On the negative side, it tends to have a larger wait-time variance.One very popular policy is called Look. The disk head is either in an inwardseekingphase or an outward-seeking phase at any time. As it seeks inward, it picks upany requests it passes. It changes direction only when there are no more requests ahead;it then switches to seeking outwards and fills all requests in that direction as it gets tothem. When requests come so frequently that the disk can barely keep up, a circular variant,C-Look, can lead to better variance among the request latencies. This variant alwaysseeks inward. When the last request has been serviced in that direction, a single seek isperformed to the outermost track with a pending request without picking up any requests

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

Saved successfully!

Ooh no, something went wrong!