Mass Storage & Disk Scheduling

SCAN scheduling

/ scan /

Think of an elevator again. It does not dash to whoever called most recently; it picks a direction and sweeps that way, stopping for every waiting passenger on the path, until it reaches the top, then turns around and sweeps back down, again stopping for everyone. Nobody is skipped forever, and nobody causes a wasteful zig-zag. SCAN scheduling moves a disk arm exactly like this elevator — which is why it is nicknamed the elevator algorithm.

Concretely, in SCAN the head moves steadily in one direction (say toward higher track numbers), servicing every pending request it passes, until it reaches the last track in that direction; then it reverses and sweeps back the other way, again servicing requests in order. There are well-known variants. C-SCAN (circular SCAN) sweeps in only one direction servicing requests, then jumps straight back to the start without servicing on the return, which gives more uniform wait times. LOOK and C-LOOK are the practical refinements: instead of driving all the way to the disk's physical edge, the arm reverses (or jumps back) as soon as there are no more requests ahead in its direction — so it only travels as far as the work actually requires.

Why it matters: SCAN and its relatives solve SSTF's starvation problem. Because the arm methodically sweeps the whole range, even a distant request is guaranteed to be served on the current or next pass — its wait is bounded. The trade-off is that SCAN may not be quite as good as SSTF on average seek distance for a given moment, but it is fair and predictable, which matters more in practice. LOOK and C-LOOK are what most real disk schedulers actually resembled, since walking to the unused edge of the platter is pure waste. As with all of these, remember the caveat: on an SSD with no seek time, none of this elevator cleverness buys much at all.

Head at 53 moving up, queue {98, 183, 37, 122, 14, 124, 65, 67}. SCAN serves upward first (65, 67, 98, 122, 124, 183), then reverses to serve the rest (37, 14). C-LOOK would serve 65...183 then jump straight back to 14 and serve 14, 37 — never wasting a trip to the physical edge.

Sweep, don't dart: every request is served within a pass or two.

C-SCAN and C-LOOK sacrifice a little raw efficiency for fairer, more uniform waits than plain SCAN, which slightly favours the tracks in the middle. None of these elevator schemes is worth much on a flash SSD.

Also called
SCANelevator algorithmC-SCANLOOKC-LOOK電梯演算法