03. Disk Geometry & Arm Scheduling

For over five decades, magnetic Hard Disk Drives (HDDs) served as the primary secondary storage substrate in computer systems. While modern operating systems increasingly boot from solid-state flash memory, understanding mechanical disk geometry and head scheduling remains essential for studying physical latency modeling, mechanical movement optimization, and sequential data locality.

1. Physical Disk Geometry: Platters, Cylinders, and Sectors

For over half a century, the magnetic hard disk drive (HDD) served as the primary secondary storage substrate in computing. Although solid-state flash drives (SSDs) have surpassed magnetic disks in random transaction performance, mechanical disk drives remain the dominant medium for massive, exabyte-scale datacenter storage due to their favorable cost-per-terabyte profile.

From an operating system engineering perspective, magnetic disks provide a textbook case study in mechanical latency modeling, asymmetric access costs, and physical resource scheduling. To write efficient filesystem and buffer cache algorithms, kernel developers must understand the microscopic electro-mechanical physics governing disk hardware.

Figure 2.1: Electro-Mechanical Organization of a Modern Magnetic Hard Drive
Platter stacking, aerodynamic slider flying height, embedded servo sectors, and Zoned Bit Recording (ZBR).
FLUID BEARING SPINDLE Constant Angular Velocity (7200 RPM) Sector CYLINDER VOICE-COIL PIVOT (Permanent Magnet + Coil) R/W HEADS GMR / TMR Sensors AERODYNAMICS & HEAD FLYING HEIGHT THE NANOMETER CATASTROPHE: Human Hair Diameter: ∼75,000 nm Dust / Smoke Particle: ∼1,500 nm Fingerprint Smear: ∼600 nm Head Fly Height: 5 – 10 nm! ZONED BIT RECORDING (ZBR) • Outer tracks have larger circumference (C = 2πr) than inner tracks. • Outer tracks hold up to 2× more sectors. Throughput Asymmetry: Outer Zone: ∼260 MB/s (High Speed) Inner Zone: ∼120 MB/s (Slow Speed)

Anatomy of the Mechanical Hard Disk

A modern hard disk drive is an ultra-precise, hermetically sealed unit containing several key mechanical and magnetic subsystems:

1. Platters & The Spindle Motor

The storage medium consists of one or more stacked, rigid circular disks called platters, fabricated from high-strength aluminum-magnesium alloys or specialized glass-ceramic substrates.

Key Structural Details:

  • Both the top and bottom surfaces of each platter are coated with a sub-micron sputtered magnetic thin film (cobalt-chromium-platinum alloys) protected by an atomic-layer diamond-like carbon (DLC) wear barrier.
  • The platters rotate together on a central spindle motor operating at a strict Constant Angular Velocity (CAV). Enterprise servers use drives spinning at 10,000 or 15,000 RPM, while consumer storage rotates at 5,400 or 7,200 RPM.
  • Enterprise drives replace internal air with Helium gas (which has one-seventh the density of air), dramatically reducing turbulent air drag, motor power consumption, and mechanical vibration across stacks of up to 10 platters.

2. Read/Write Heads & Voice-Coil Actuator

Data is sensed and recorded by microscopic electromagnetic read/write heads mounted on a shared rotary actuator arm driven by a high-speed Voice-Coil Motor (VCM).

The Physics of Head Flying Height:

  • The heads never physically touch the platter surface during operation. The rapid rotation of the platter generates an aerodynamic air cushion (an air bearing) that lifts the head slider, causing it to "fly" merely 5 to 10 nanometers above the spinning media.
  • For perspective, a single human hair is ∼75,000 nm in diameter, a smoke particle is ∼1,500 nm, and a fingerprint ridge is ∼600 nm. If a dust particle enters the chamber, it hits the head at 120 km/h, causing a catastrophic Head Crash that scrapes off the magnetic recording layer and permanently destroys data!
  • Modern heads use separate technologies: Tunneling Magnetoresistive (TMR) sensors for reading minute magnetic fluctuations, and inductive coils for writing.

The Geometry Hierarchy: Tracks, Cylinders, and Sectors

Data recorded on platters is organized along three geometric dimensions:

The Evolution of Addressing: From CHS to Logical Block Addressing (LBA)

1. Cylinder-Head-Sector (CHS) Addressing & Historical Barriers

In early operating systems (such as MS-DOS and early Unix on IBM PCs), the kernel had to explicitly calculate and provide the 3-dimensional physical coordinates for every disk operation:

/* Historical CHS Access: Read Cylinder 20, Head 2, Sector 5 */
struct chs_address {
    uint16_t cylinder; /* 0 .. 1023 (10 bits) */
    uint8_t  head;     /* 0 .. 15 (4 bits)   */
    uint8_t  sector;   /* 1 .. 63 (6 bits - 1-indexed!) */
};

CHS addressing contained a fatal flaw: the combination of BIOS register limitations (10 bits for cylinders, 4 bits for heads, 6 bits for sectors) created the notorious 504 MiB Barrier:

$$\text{Max CHS Capacity} = 1024\text{ Cylinders} \times 16\text{ Heads} \times 63\text{ Sectors} \times 512\text{ Bytes} = \mathbf{528{,}482{,}304\text{ Bytes (504 MiB)}}$$
2. Zoned Bit Recording (ZBR / Zone CAV)

Beyond the BIOS architectural limits, CHS was destroyed by basic physics: rigid geometry is geometrically inefficient.

Because a disk platter is circular, the circumference of an outer track is more than twice the circumference of an inner track:

$$\text{Track Circumference} = 2\pi r$$

Under historical CHS, every track was forced to contain the exact same number of sectors (e.g. 63 sectors per track). This meant magnetic bit transitions on outer tracks were spaced far apart, wasting massive amounts of surface area.

Modern drives implement Zoned Bit Recording (ZBR):

3. Logical Block Addressing (LBA) & Controller Virtualization

Because Zoned Bit Recording destroyed uniform CHS dimensions, the storage industry transitioned universally to Logical Block Addressing (LBA):

Physical Latency Mitigations: Track and Cylinder Skewing

To prevent catastrophic rotational latency penalties during sequential reads, disk controllers implement microscopic angular offsets known as skewing:

Track Skewing

Suppose a sequential file spans Track 0 and Track 1. If Sector 0 on Track 1 is placed at the exact same angular position as Sector 0 on Track 0:

When the head finishes reading Track 0, it takes approximately 0.8 milliseconds for the actuator arm to mechanically step to Track 1.

During those 0.8 ms, the platter spins past Sector 0! The head lands over Sector 4, forcing the disk to wait almost an entire physical revolution (8.3 ms at 7200 RPM) just to read Sector 0!

The Solution: The controller offsets (skews) Sector 0 on Track 1 by several angular positions, ensuring that exactly as the head settles onto Track 1, Sector 0 spins directly underneath it.

Defect Management (G-List & P-List)

No physical platter is manufactured without microscopic silicon imperfections. Controllers maintain two defect lists:

1. Primary Defect List (P-List): Populated at the factory during low-level surface scanning. Defective sectors are skipped during initial track mapping (sector slipping).

2. Grown Defect List (G-List): When a sector fails in the field due to magnetic wear, the controller marks the sector bad and transparently remaps that LBA to an unallocated spare sector reserved on an inner or outer track.

OS Performance Impact: While remapping preserves data integrity, reading a remapped sector requires the actuator arm to seek to the spare track and back, causing sudden anomalous latency spikes during sequential reads.

2. Modeling I/O Access Latency (TI/O)

To an operating system kernel, secondary storage operations are enormously expensive compared to register and cache access. Reading a block of data from main DRAM requires tens of nanoseconds, whereas reading a block from a mechanical hard disk requires millions of nanoseconds.

To design effective disk scheduling algorithms and filesystem page caches, we must construct a rigorous mathematical latency model decomposed into its physical and electronic sub-components:

TI/O = Tseek + Trotational + Ttransfer + Tcontroller
Figure 2.2: Time-Domain Decomposition of a Random 4 KB Disk Read Operation (~10.2 ms)
Visualizing how mechanical arm movement and platter rotation dwarf electronic transfer time by over 500 to 1.
SEEK TIME (T_seek): 6.00 ms (58.8%) Arm acceleration, coasting, deceleration, head settling ROTATIONAL DELAY (T_rot): 4.17 ms (40.9%) Waiting for target sector to spin under head (7200 RPM) 0.0 ms 6.00 ms 10.17 ms T_transfer + T_ctrl: ~0.03 ms (0.3%) THE MECHANICAL LATENCY REALITY (Random 4 KB Read = ~10.20 ms): • Mechanical Latency (Seek + Rotation): Consumes 10.17 ms (99.7% of total I/O time). • Electronic Transfer Time (4 KB @ 200 MB/s): Consumes 0.02 ms (less than 0.2% of total time). • Controller & Bus Handshake Overhead: Consumes 0.01 ms (0.1% of total time).

1. Seek Time (Tseek): The Voice-Coil Mechanics

Seek time is the physical delay required for the voice-coil actuator arm to position the read/write heads radially across the platters and align precisely over the target cylinder.

An actuator movement is not an instantaneous, uniform velocity slide. The voice-coil motor must obey classical Newtonian mechanics across four distinct physical phases:

  1. Acceleration Phase: Maximum electrical current is driven through the coil, creating an intense magnetic field against the permanent rare-earth magnets to accelerate the mass of the arm.
  2. Coasting Phase: For long seeks across hundreds of cylinders, the arm reaches its maximum terminal velocity and coasts across the platter radius.
  3. Deceleration Phase: Reverse current is applied through the voice coil, exerting braking force to bring the high-speed arm to a controlled stop over the target cylinder.
  4. Head Settling Time: The heads vibrate slightly upon arrival. The closed-loop servo mechanism reads embedded magnetic servo bursts to dampen oscillations and settle the head within the target track boundary (a mechanical settling budget of 0.5 to 1.5 milliseconds).
Seek Classification Typical Duration Physical Description
Track-to-Track Seek 0.5 – 1.5 ms Stepping between immediately adjacent cylinders (dominated entirely by settling time).
Full-Stroke Seek 15.0 – 20.0 ms Traveling across the entire radius of the disk (from innermost cylinder to outermost cylinder).
Average Seek Time 4.0 – 9.0 ms The expected seek time between two uniformly distributed random cylinders across the disk.
Mathematical Derivation: The 1⁄3 Disk Stroke Law
Suppose a disk has N cylinders numbered continuously from 0 to N. If target requests are uniformly and independently distributed across all cylinders, what is the average physical seek distance traveled between two consecutive random requests located at positions x and y?

The expected distance is given by the continuous double integral over the disk radius:
Expected Seek Distance = 1⁄N2 ∫0N ∫0N |x - y| dx dy = N⁄3
On average, a completely random seek travels one-third of the entire disk surface stroke! This statistical law allows operating system simulators to accurately estimate average random seek times as approximately one-third of the full-stroke seek duration.

2. Rotational Latency (Trotational): Platter RPM Physics

Once the voice-coil arm settles precisely over the target cylinder, the read head cannot immediately begin reading data. The target sector may currently be on the opposite side of the rotating platter. The time required for the target sector to rotate underneath the read head is the Rotational Latency.

Because disk platters rotate at a strict Constant Angular Velocity (CAV) measured in Revolutions Per Minute (RPM), the period of one complete physical revolution (Trev) is constant:

Trev = ( 60⁄RPM ) × 1000 ms

Assuming random access, the target sector may arrive immediately beneath the head (best case: 0 ms), or it may have just passed the head by a fraction of a millimeter (worst case: one full physical revolution, Trev).
Under a uniform distribution, the Average Rotational Latency (Trot (avg)) is exactly half a revolution:

Trot (avg) = 1⁄2 × Trev = ( 30⁄RPM ) × 1000 ms
Spindle Speed (RPM) Full Revolution Period Average Rotational Latency Target Market Segment
5,400 RPM 11.11 ms 5.56 ms Consumer laptops, low-power NAS archives
7,200 RPM 8.33 ms 4.17 ms Standard desktop storage, datacenter bulk arrays
10,000 RPM 6.00 ms 3.00 ms Enterprise mission-critical database storage
15,000 RPM 4.00 ms 2.00 ms High-performance SAS enterprise drives

3. Transfer Time (Ttransfer) & Controller Overhead

Once the head settles over the cylinder and the target sector rotates underneath, the drive enters the Transfer Phase.

The 500× Asymmetry: Random vs. Sequential Performance

We can now calculate the catastrophic performance penalty of random I/O versus sequential streaming on a modern 7,200 RPM mechanical drive:

Case 1: Random Access (4 KB Block)

Physical Seek & Rotation Paid on Every Block

Every 4 KB read accesses an arbitrary, disjoint cylinder:

Tseek ≈ 6.00 ms
Trot ≈ 4.17 ms
Ttransfer ≈ 0.02 ms
Total Time (TI/O): ≈ 10.19 ms

IOPS = 1 / 0.01019 s ≈ 98 IOPS
Throughput = 98 × 4 KB ≈ 0.39 MB/s!

Case 2: Sequential Access (Streaming)

Seek & Rotation Amortized to Zero

Blocks reside contiguously along the same track:

Initial Seek + Rotation paid ONCE for the entire stream.
Subsequent blocks stream continuously as the track rotates.
Track skewing prevents rotational misses between tracks.

IOPS = Not seek-bound
Throughput = Wire Media Rate ≈ 200.00 MB/s!

The Core Architectural Lesson:
Sequential I/O is more than 500 times faster than random I/O on mechanical storage ($200\text{ MB/s}$ vs. $0.39\text{ MB/s}$).

This vast performance disparity explains why operating system kernels incorporate:

3. Disk Arm Scheduling Algorithms

In a multiprogramming operating system, dozens of processes issue concurrent reads and writes to storage. Because mechanical seek time and rotational delay dwarf electronic transfer speeds by over 500 to 1, the order in which pending disk requests are serviced directly dictates overall system throughput and interactive responsiveness.

When an application issues a file read, the operating system block layer enqueues the request into a kernel dispatch queue. The Disk Arm Scheduler (or I/O elevator) reorders, merges, and dispatches pending requests to optimize physical head trajectory.

Figure 2.3: Trajectory Comparison Across Classical Disk Scheduling Policies
Spatial head paths across cylinders 0 to 199 starting from cylinder 53 with pending queue [98, 183, 37, 122, 14, 124, 65, 67].
1. FCFS (FIFO) Movement: 640 Cylinders 0 199 Wild full-stroke thrashing Slowest Throughput 2. SSTF (GREEDY) Movement: 236 Cylinders 0 199 Trapped in local cluster Outer Starvation Hazard 3. SCAN (ELEVATOR) Movement: 208 Cylinders 0 199 Sweeps to edge; reverses Zero Starvation 4. C-LOOK (CIRCULAR) Movement: 322 Cylinders 0 199 Bounded to active requests Uniform Wait Distribution

The Dual Mandate of the Disk Arm Scheduler

An effective disk scheduler must balance two fundamentally competing objectives:

  1. Throughput Maximization: Squeezing the maximum number of megabytes per second out of the physical platters. This requires minimizing aggregate seek distance and reducing the frequency of head turnaround reversals:
    Total Seek Cost = ∑i=1K | Cylinderi - Cylinderi-1 |
  2. Fairness & Bounded Latency: Ensuring that no single I/O request starves in the queue indefinitely while the arm services requests closer to the active cylinder cluster.
Request Merging: Optimization Before Scheduling:
Before any arm movement algorithm evaluates pending requests, the operating system block layer executes Request Merging: Merging eliminates physical seek operations entirely by converting multiple small random I/O operations into a single continuous streaming burst!

Detailed Algorithmic Analysis

1. First-Come, First-Served (FCFS)

The baseline scheduling policy services requests strictly in the chronological order of their arrival into the queue:

2. Shortest Seek Time First (SSTF)

SSTF applies a greedy heuristic: among all pending requests in the queue, it selects the request that requires the minimum physical seek distance from the current head position:

Next Target = argminr ∈ Q | Headcurrent - Cylinderr |
3. SCAN (The Elevator Algorithm)

To eliminate starvation while preserving spatial locality, the SCAN algorithm mimics a commercial building elevator:

4. C-SCAN (Circular SCAN)

C-SCAN corrects the non-uniform wait distribution of SCAN by restricting servicing to a single sweep direction:

5. LOOK and C-LOOK (Industrial Optimizations)

Standard SCAN and C-SCAN waste significant mechanical travel by driving the arm all the way to the absolute physical edge of the disk (Cylinder 0 and Cylinder 199) even when no requests are pending at those extreme boundaries.

LOOK and C-LOOK add a forward-inspection lookahead:

Modern Operating System Scheduling Architectures

In modern Linux and Windows kernels, disk scheduling has moved beyond pure geometric heuristics to address quality-of-service and hardware-offloaded queues:

1. The Linux Deadline Scheduler

Separates requests into multiple queues:

  • Sorted Elevator Queue: Standard C-LOOK ordering to maximize throughput.
  • Read FIFO Queue: Hard expiration deadline of 500 ms.
  • Write FIFO Queue: Relaxed expiration deadline of 5000 ms (5 s).
Why Prioritize Reads? Applications issuing reads typically block until data is returned. Writes are buffered asynchronously in the page cache. If a read request approaches its 500 ms deadline, the scheduler aborts elevator ordering and services the read immediately!

2. Native Command Queuing (NCQ)

Modern SATA and SAS drives implement hardware-side scheduling:

  • The host OS dispatches up to 32 commands simultaneously (or 256 in SCSI TCQ) into the drive controller's internal queue.
  • The on-drive microprocessor knows the exact real-time angular position of the spinning platters (which the host OS cannot know due to PCIe bus latency).
  • The drive controller executes Rotational Position Sorting (RPS), dynamically choosing the request that minimizes the sum of seek time plus immediate rotational delay!

Interactive Stepper: Disk Arm Scheduling Visualizer (0 – 199 Cylinders)

Scheduling Policy SSTF (Shortest Seek Time First): Always chooses the pending request closest to the current head cylinder. Minimizes seek distance greedily, but risks starving distant cylinders.
Current Head Position Cylinder 53
Target Cylinder Start (53)
Seek Hop Distance 0 Cylinders
Total Head Movement 0 Cylinders
Pending Requests 8 Remaining
0 50 100 150 199 53
Current Step Summary Initial State: Disk head parked at Cylinder 53. Pending queue: [98, 183, 37, 122, 14, 124, 65, 67]. Ready to schedule.
What Is Happening

Head is parked at cylinder 53. The scheduler assesses the queue to pick the first target.

Why The System Does This

Baseline setup before mechanical arm acceleration begins.

Algorithm Analysis & Comparisons

Algorithm Head Movement (Workload) Core Behavioral Characteristic Primary Defect / Limitation
FCFS 640 Cylinders Completely fair, zero starvation. Wild head thrashing; slowest throughput.
SSTF 236 Cylinders Greedy local minimum; fast response under low loads. Pathological Starvation of outer tracks.
SCAN (Elevator) 208 Cylinders Sweeps end-to-end; eliminates starvation completely. Unequal waiting distribution for recent cylinders.
C-LOOK 322 Cylinders Single-direction sweep with fast return; uniform wait times. Slightly higher total head movement than SCAN.