Appearance
43. Disk Scheduling (SSTF, SCAN, etc.)
Moving a physical disk head is slow (ms-scale), so request order matters enormously on spinning disks.
Example — head at track 50, queue = [98, 183, 37, 122, 14, 124, 65, 67]:
| Algorithm Total head movement | |
|---|---|
| FCFS (arrival order) | 640 tracks |
| SSTF (nearest first) | 236 tracks |
| SCAN (elevator, sweep + reverse) | 248 tracks |
| C-SCAN (one direction, jump back) | 322 tracks |
| C-LOOK (like C-SCAN, but only as far as the last request) | 299 tracks |
- FCFS: simple, fair, but zigzags wildly — worst movement.
- SSTF: always serve the closest request — much better movement, but can starve far-away requests forever.
- SCAN (elevator): sweep fully in one direction serving everything, then reverse — no starvation, but the far end waits for a full sweep.
- C-SCAN: serve in one direction only; on return, jump straight back to the start without serving — more uniform wait times at both ends of the disk.
- C-LOOK: a practical C-SCAN that only goes as far as the last actual request in each direction, not the physical end of the disk.
Does this still matter? Yes for HDDs (real mechanical seek time). Largely no for SSDs (no moving parts, near-zero seek time) — modern Linux uses NOOP/deadline schedulers for SSDs instead.