FCFS and SSTF Disk Scheduling

Why the Order of Disk Requests Actually Matters

A mechanical hard disk's read/write head must physically move across the disk's surface to reach different data - unlike RAM, where any address is equally fast to reach, a disk's access time depends heavily on how far the head must physically travel. Disk scheduling decides the order in which pending requests are serviced to minimize this movement.

FCFS Disk Scheduling: Simply Service Requests in Arrival Order

Head starts at track 50
Request queue (in arrival order): 95, 20, 80, 10

Head movement: 50 -> 95 -> 20 -> 80 -> 10
Total head movement: 45 + 75 + 60 + 70 = 250 tracks

Just like FCFS process scheduling (covered earlier in this section), FCFS disk scheduling simply services requests in the exact order they arrive - simple and fair in that sense, but as shown above, it can cause a huge amount of unnecessary head movement by jumping back and forth erratically.

SSTF: Always Service the Closest Request Next

Head starts at track 50
Request queue: 95, 20, 80, 10

Head movement: 50 -> 80 (closest) -> 95 (closest remaining) -> 20 (closest remaining) -> 10
Total head movement: 30 + 15 + 75 + 10 = 130 tracks

Shortest Seek Time First (SSTF) always services whichever pending request is physically closest to the head's current position - dramatically reducing total head movement compared to FCFS in this example.

SSTF's Real Weakness: Potential Starvation

If requests keep arriving near the head's current position, a request sitting far away can be repeatedly passed over and effectively starved - the exact same starvation problem covered in the CPU scheduling section, just showing up here in a disk-scheduling context instead.

Why Neither of These Is the Final Answer

SSTF solves FCFS's inefficiency but introduces a real fairness problem - motivating the SCAN and LOOK family of algorithms, covered in the next two notes, which aim to balance both efficiency and fairness together.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.