HARD DISK#198#2183#337#4122#514#6124#765#867050100150199TIME ↓1839011575130FCFS next = oldest requestSSTF next = nearest trackSCAN next = nearest aheadFCFSSSTFSCANTRACKS MOVED
Back: the hard disk and the request queueMiddle: the tracks 0 to 199 in a line, with the head; front: the head's path over timePink FCFS, green SSTF, violet SCAN; the score counts tracks movedAt the back, the hard disk and the operating system's queue of eight requests. In the middle, the disk's tracks in a line, from 0 at the outer edge to 199 at the inner edge, with the head. In front, the head's path drawn row by row, top to bottom in time. First come first served zigzags 640 tracks. Shortest seek time first moves 236 but lets a far request starve. SCAN sweeps down to the edge and back up for 236, serving everyone. The figure lays the tracks out in a straight line, from track 0 at the outer edge to track 199 at the inner edge, and pretends each request names a track. A real OS sees numbered blocks instead, and nearby block numbers usually sit on nearby tracks, so it orders requests by block number (nearest-block-first).

The disk and its queue

  1. A hard disk keeps data on rings called tracks. To read one, an arm must move the head to that track first: a seek. Seeks are slow, about 4 to 9 ms on average, so less arm travel means faster reads.

Three orders

Which is best?

What happens

;; step 1/8 · disk
time for one read = seek + rotation + transfer

seek       move the arm to the right track
rotation   wait for the data to spin under the head
transfer   read the bytes

average seek (OSTEP, Fig. 37.5):
  Cheetah 15K.5    15,000 RPM   4 ms
  Barracuda         7,200 RPM   9 ms

Below, the tracks are laid out in a straight line:
track 0 at the outer edge, track 199 at the inner edge.

The figure lays the tracks out in a straight line, from track 0 at the outer edge to track 199 at the inner edge, and pretends each request names a track. A real OS sees numbered blocks instead, and nearby block numbers usually sit on nearby tracks, so it orders requests by block number (nearest-block-first). Only seek distance is counted here. A real read also waits for the data to spin under the head; a drive that knows both can use shortest positioning time first (SPTF), which modern drives run internally.