Magnetic Hard Disk Drives (HDDs) are mechanical devices. They consist of a spinning magnetic platter and a mechanical arm (read-write head) that moves radially across the platter.
Because mechanical movement is millions of times slower than electronic execution, the time it takes to move the disk arm to the correct track—known as Seek Time—is the primary bottleneck in disk performance.
If multiple processes submit I/O requests simultaneously, the Operating System maintains a queue of requests. The OS uses Disk Scheduling Algorithms to reorder this queue, minimizing the total movement of the disk arm.
(Note: These algorithms are entirely irrelevant for modern Solid State Drives (SSDs), as SSDs have no moving parts and zero seek time).
1. FCFS (First-Come, First-Served)
The simplest form of disk scheduling is FCFS. Requests are serviced in the exact order they arrive.
Pros: Inherently fair. No request will ever starve.
Cons: Extremely inefficient. If requests arrive for track 10, then track 190, then track 12, the disk arm swings wildly back and forth across the entire platter, maximizing mechanical wear and resulting in terrible performance.
2. SSTF (Shortest Seek Time First)
SSTF selects the request with the minimum seek time from the current head position. It chooses the pending request closest to the current head position.
Pros: Substantially improves performance and average response time compared to FCFS.
Cons: Can cause Starvation. If the head is currently at track 14, and a continuous stream of requests arrives for tracks 10, 11, 15, and 16, a request waiting for track 190 will be indefinitely postponed.
3. SCAN (The Elevator Algorithm)
The disk arm starts at one end of the disk and moves toward the other end, servicing requests as it reaches each cylinder, until it gets to the other end of the disk. At the other end, the direction of head movement is reversed, and servicing continues.
Analogy: It behaves exactly like an elevator. An elevator traveling up will stop at all requested floors on its way up before reversing direction to service down requests.
Pros: Provides a more uniform wait time than SSTF and prevents starvation.
4. C-SCAN (Circular SCAN)
A variant of SCAN designed to provide a more uniform wait time. Like SCAN, C-SCAN moves the head from one end of the disk to the other, servicing requests along the way.
Difference: When the head reaches the end, it immediately returns to the beginning of the disk without servicing any requests on the return trip.
Why? By the time the head reaches the far edge, the heaviest density of new requests is likely waiting at the opposite edge (the beginning), since those tracks have not been serviced for the longest time.
5. LOOK and C-LOOK
In practice, neither SCAN nor C-SCAN is implemented exactly as described. SCAN forces the disk arm to move all the way to track 0 and track 199, even if there are no requests there.
LOOK Algorithms: The arm only goes as far as the final request in each direction. As soon as there are no more requests in the current direction, the arm reverses direction immediately, without "looking" at the empty tracks at the absolute edges of the disk.