A disk scheduling question gives you a queue of cylinder requests, the head's starting cylinder and sometimes a direction, and asks for the order the requests are served and the total head movement (the sum of the distances the head travels). This page works one classic example through all six algorithms.
The example (the one in Silberschatz's Operating System Concepts): cylinders 0–199, head at 53, queue 98, 183, 37, 122, 14, 124, 65, 67.
FCFS: in the order they arrive
53 → 98 → 183 → 37 → 122 → 14 → 124 → 65 → 67
45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640 cylinders
Fair and simple, but the head swings back and forth across the disk.
SSTF: nearest request next
From the current position, always go to the closest pending request.
53 → 65 (12) → 67 (2) → 37 (30) → 14 (23) → 98 (84) → 122 (24) → 124 (2) → 183 (59)
total = 236 cylinders
At 67, the nearest remaining requests are 37 (30 away) and 98 (31 away), so it goes back to 37. SSTF cuts movement sharply but can starve a far request if new nearby ones keep arriving. When two requests are equally close, most courses break the tie by queue order.
SCAN (elevator): sweep to the edge, then reverse
The head moves in one direction to the end of the disk, serving requests on the way, then reverses. Moving towards 0 first:
53 → 37 → 14 → 0 → 65 → 67 → 98 → 122 → 124 → 183
(53 − 0) + (183 − 0) = 53 + 183 = 236 cylinders
C-SCAN: sweep one way, jump back
Like SCAN, but only serves requests in one direction. At the end it jumps to the other end and sweeps the same way again, giving more uniform waiting times. Moving towards higher cylinders:
53 → 65 → 67 → 98 → 122 → 124 → 183 → 199 → 0 → 14 → 37
(199 − 53) + (199 − 0) + (37 − 0) = 146 + 199 + 37 = 382 cylinders
Watch the convention. Some courses don't count the jump from 199 back to 0 as head movement, which gives 382 − 199 = 183. Check which your instructor uses; the jump is a real seek on real hardware.
LOOK and C-LOOK: turn at the last request
LOOK is SCAN without the trip to the edge: the head reverses at the last request in its direction. Towards 0 first:
53 → 37 → 14 → 65 → 67 → 98 → 122 → 124 → 183
(53 − 14) + (183 − 14) = 39 + 169 = 208 cylinders
C-LOOK is C-SCAN that turns at the last request and jumps to the lowest pending request. Moving up:
53 → 65 → 67 → 98 → 122 → 124 → 183 → 14 → 37
(183 − 53) + (183 − 14) + (37 − 14) = 130 + 169 + 23 = 322 cylinders (153 without the jump)
All six side by side
| Algorithm | Head moving towards 0 | Head moving towards 199 |
|---|---|---|
| FCFS | 640 | 640 |
| SSTF | 236 | 236 |
| SCAN | 236 | 331 |
| C-SCAN | 386 (187 without the jump) | 382 (183 without the jump) |
| LOOK | 208 | 299 |
| C-LOOK | 326 (157 without the jump) | 322 (153 without the jump) |
FCFS and SSTF don't depend on direction. For the others, direction matters a lot: here the head starts near the low end, so sweeping down first is cheaper.
Where answers differ between textbooks
- SCAN goes to the edge; LOOK doesn't. Some sources (and some exam keys) use "SCAN" to mean LOOK. If your answer is off by twice the distance to the edge, this is why.
- Counting the C-SCAN / C-LOOK return jump. Galvin's examples count it; many university keys don't.
- A request at the head's cylinder is normally served immediately, at zero distance.
- SSTF ties are broken by queue order unless the question says otherwise.
Check your own answers
The disk scheduling calculator runs all six algorithms on your queue, draws the head path, shows every seek distance, and has a switch for counting the return jump. For the other scheduling topics, see the CPU scheduler and the page replacement simulator.
For a related walkthrough, read Round Robin Scheduling Example with Gantt Chart.