One or more platters coated with magnetic media on both sides.
A rack of read-write heads on arms.
Disk media partitioned into tracks, and tracks into sectors, and
tracks through disks into cylinders.
Sectors are small, 256 to 1k bytes.
Rotations from 4,000 to 15,000 rpm.
Rotational latency, seek latency, transfer delay.
Disk Controllers
The electronics between the disk hardware and the rest of the system.
Gradual function shift operating systems to disk controllers (and
device controllers in general).
Error correction, encryption, super blocking.
Implements the bus protocol: scsi, sata (serial advanced technology
attachment), usb (universal serial bus).
And disk arm scheduling.
But there still is a place for os control.
Higher-level matters not identified with individual disk I-O
operations.
Priority (os access vs user access).
Specific use (paging or swapping I-O vs general disk I-O).
Disk Driver
Translate from the application API to the disk controller API.
read() → SCIS (for example) commands.
Implement other, os-specific resource parts.
open() has no counterpart at the controller interface.
Moderate other differences between the applicaion resource and the
implementing device.
Disk Scheduling
Disks are sharable above the block read-write level.
Multiple independent io requests.
How to send requests to the disk to maximize disk throughput: the
disk-schedulng problem.
FCFS scheduling: send requests to the disk in the order received at
the driver.
pluses: easy to implement; minuses: absuses the mechanicals to get
terrible throughput.
Shortest seek-time next scheduling: the next request is the one
closest to the disk heads.
pluses: better throughput than fcfs; minuses: starvation.
Scan (elevator) scheduling: the next request is the one closest to
the disk heads in the direction of travel, which changes only at the
cylinder extremes.
plusses: no starvation; minuses: longer wait times.
Look-Scan scheduling: the next request is the one closest to
the disk heads in the direction of travel, directions changes when there
are no more requests in the current direction.
plusses: shorter (potentially) wait times; minuses: potential long
wait times (round trip).
Circular scan scheduling: pick a direction, scan in that direction,
then return without io to start again.
shorter wait times (half-round trip)
Look circular scan scheduling: pick a direction, scan in that
direction, then return without io to start again.
shorter wait times (half-round trip)
Picking a scheduler.
The best scheduling policy depends on circumstances (surprise!).
For lightly loaded disks, SSTN scheduling performs best.
For heavily loaded disks, a look variant of either scan works best.
Buffering and Caching
Buffering
Smooth out differences between application model and device reality.
Caching
Buffers that exploit temporal or spatial locality.
Temporal locality: if you touched it now, you’re probably
going to touch it in .
Spatial locality: if you touched location i, you’re
probably going to touch i ± 1 too.
File-system metadata: information about the file system.
Buffers that last longer than one application’s use.