SCAN and C-SCAN Disk Scheduling
- Process Management
- Memory Management
- Deadlocks
- OS Introduction & Fundamentals
- CPU Scheduling Algorithms
- Threads & Concurrency
- Inter-Process Communication (IPC)
- Process Synchronization
- Virtual Memory & Paging
- File Systems
- Disk Scheduling
- I/O Management
The "Elevator Algorithm": Sweeping in One Direction, Then Reversing
SCAN works like a building elevator: the head moves in one direction, servicing every request it passes along the way, all the way to the end of the disk - then reverses direction and sweeps back the other way.
Head starts at track 50, moving toward higher track numbers
Request queue: 95, 20, 80, 10 (disk range: 0 to 100)
Movement: 50 -> 80 -> 95 -> 100 (end of disk) -> 20 -> 10
(services every request it passes, then reverses at the very end)Unlike SSTF, SCAN guarantees every waiting request will eventually be serviced within one full sweep in each direction, directly solving SSTF's starvation problem covered in the previous note - no request can be passed over indefinitely.
A Minor Inefficiency SCAN Still Has
SCAN travels all the way to the very end of the disk, even if there are no actual pending requests anywhere near that end - genuinely wasted movement in that specific case, servicing nothing along the way but still consuming time and distance.
C-SCAN: Circular SCAN, More Consistent Wait Times
Head starts at track 50, moving toward higher track numbers
Request queue: 95, 20, 80, 10
Movement: 50 -> 80 -> 95 -> 100 (end) -> jump immediately back to 0 -> 10 -> 20
(only services requests while moving in ONE direction; jumps back without servicing on the return)C-SCAN (Circular SCAN) only services requests while moving in one direction. Upon reaching the end, it jumps immediately back to the beginning without servicing anything along that return jump, then starts sweeping forward again - producing more uniform, predictable wait times across all pending requests, compared to plain SCAN's back-and-forth pattern.
Why C-SCAN's More Uniform Wait Times Matter
Under plain SCAN, a request right behind the head as it reverses gets serviced almost immediately, while one just missed gets serviced only after nearly a full sweep - a meaningfully uneven wait time. C-SCAN's one-directional servicing pattern makes every request's wait time far more consistent and predictable.