Source: Operating Systems: Three Easy Pieces (OSTEP) — Chapter 37, Arpaci-Dusseau & Arpaci-Dusseau
Hard Disk Drives
Hard drives were the main persistent store for decades; file-system design still leans on their behavior [RW92, ADR03].
Crux: how do HDDs store and access data? What is the interface? How does scheduling help?
Interface
A drive is an array of sectors (classically 512 B), addressed 0 … n−1. Multi-sector I/O is common (e.g. 4 KB FS blocks), but manufacturers typically guarantee atomicity only for a single sector — larger writes can be torn on power loss.
Unwritten contract [SG04]: nearby LBAs are faster than distant ones; sequential access is fastest.
Geometry
| Piece | Role |
|---|---|
| Platter / surface | Magnetic media (often 2 sides per platter) |
| Spindle | Spins at fixed RPM (e.g. 7.2K–15K) |
| Track | Concentric ring of sectors |
| Head / arm | Sense or write magnetism; seek across tracks |
I/O time: seek → rotational delay → transfer.
Seek phases: accelerate, coast, decelerate, settle (often 0.5–2 ms). Track skew keeps sequential I/O from missing the next sector after a track switch. Multi-zone disks put more sectors on outer tracks. On-drive cache (track buffer): reads may prefetch a track; writes may be write-back (fast, risky for ordered durability) or write-through.
Rank the sequence
1 / 1Order the phases of a disk arm seek (top = first).
OrderDrag the handle to rearrange — top should be first.
- 1Settle
- 2Decelerate
- 3Coast
- 4Accelerate
Drag items into the correct order (or use ↑↓), then check.
Doing the math
T_I/O = T_seek + T_rotation + T_transfer
R_I/O = Size / T_I/O
Dimensional analysis helps: 10K RPM → 6 ms/rotation; half-rotation average ≈ 3 ms at 10K, 2 ms at 15K.
Random vs sequential (Cheetah- vs Barracuda-class numbers in the text): random 4 KB may be ~0.3–0.7 MB/s; sequential approaches ~100+ MB/s — often 200–300× apart.
Prefer sequential transfers, or at least large contiguous chunks. Tiny random I/O destroys performance.
Average seek distance over all track pairs ≈ ⅓ of a full stroke (geometry integral) — that is where the “one-third” lore comes from.
Disk scheduling
The scheduler estimates positioning cost and approximates SJF.
| Policy | Idea | Caveat |
|---|---|---|
| SSTF / NBF | Nearest track / nearest LBA next | Starvation of far requests |
| SCAN / C-SCAN | Elevator sweeps (F-SCAN freezes queue) | Fairer; still weak on rotation |
| SPTF / SATF | Minimize seek + rotation | Needs geometry; often inside the drive |
Modern OS: pick a window of good requests, merge adjacent LBAs, let the drive’s SPTF finish. Sometimes wait briefly for a better request (anticipatory, non-work-conserving) [ID01].
Rank the sequence
1 / 1Order the steps of servicing a disk I/O request (top = first).
OrderDrag the handle to rearrange — top should be first.
- 1Seek the arm to the target track
- 2Issue the request to the drive
- 3Transfer the data
- 4Wait out the rotational delay to reach the target sector
Drag items into the correct order (or use ↑↓), then check.
Interactive
Try: geometry · I/O time · SSTF / SCAN / SPTF.
Check your understanding
Hard disk drives
1 / 6Drive manufacturers typically guarantee atomicity for…
Pick an answer to see if you are right.
Coding challenges
Homework lab: disk.py
Use the OSTEP disks homework (disk.py + animator).
Homework: file-disks / disk.py
0/5 startedSummary
| Idea | Takeaway |
|---|---|
| Sector array | Linear LBAs; sequential/nearby assumed fast |
| Mechanics | Seek + rotate + transfer |
| Workloads | Random ≪ sequential (huge gap) |
| Schedulers | SSTF → SCAN (fairness) → SPTF (rotation); merge + drive-internal reorder |
Previous: I/O Devices
Next: RAID — striping, mirroring, parity.
Further Reading
- Remzi & Andrea Arpaci-Dusseau — Operating Systems: Three Easy Pieces Ch. 37
- OSTEP file-disks PDF
- OSTEP file-disks homework
- Ruemmler & Wilkes [RW92]; Anderson et al. [ADR03]; Iyer & Druschel anticipatory scheduling [ID01]