Part 1 of 7 · 2 min read
Why this page comes first
In this module you will
- Name the parts of a hard disk and say what a track, a sector and a logical block address are.
- Split the time of one disk request into seek, rotation and transfer, and compute each from the drive's figures.
- Compute the I/O time and the data rate of a request from an RPM, a seek time and a transfer rate.
- Explain why a random 4 KiB read is hundreds of times slower than a sequential read on a spinning disk.
- Measure random and sequential reads with a short C program, and explain why a flash disk shows almost no gap.
Levels 0 to 7 dealt with the processor and with memory. Both are fast and have no moving parts. This level turns to storage and to the devices around it. The hard disk comes first because every file system idea in Level 9, and every disk scheduling idea in the next page, was designed around its moving parts. The later pages on flash disks (page 3) show which of those ideas still matter when nothing moves.
About this example About this example
Real: The C program in section 4 was compiled with gcc -Wall -Wextra and run on a Linux test machine (2 processors, kernel 6.18). That machine has a virtual flash disk, not a spinning one, so its numbers show the flash case. The rotational flag in section 5 was read from /sys/block/vda/queue/rotational on the same machine.
Scripted: The drive in sections 2 and 3 (7,200 RPM, 9 ms seek, 100 MB/s) is made up to show the idea. Real drives vary. The book figures for two Seagate drives in section 4 come from OSTEP chapter 37.
Not real: The model ignores the drive's cache, the time to switch heads, the time to move to the next track during a long read, and queued requests. A real hard disk is faster than the model on small repeated requests and slower on a very fragmented file.