# Read-on-arrival: sector order, not zero response time

This exact, constructed example illustrates the mechanism described in the
[FAST 2002 Memulator paper, section 6.1](https://static.usenix.org/events/fast02/full_papers/griffin/griffin_html/index.html).
It is not a measured HDD result or a reproduction of that paper's benchmark.

An eight-sector track is requested in full. The already-positioned head arrives
at the start of sector 3. Ordered reading waits five ticks for sector 0 and then
transfers eight sectors: 13 ticks. Read-on-arrival reads 3,4,5,6,7,0,1,2 in eight
ticks and buffers them for logical-order delivery. One tick is a sector transfer,
not a measured duration. Both paths deliver the same eight sectors.

For each request size, example.json enumerates all eight sector-start phases
with equal weight. With N sectors and S requested contiguous sectors, ordinary
mean completion is (N-1)/2 + S ticks. The mean saving is S(S-1)/(2N) ticks:
only arrivals inside the request after its first sector save time. The program
enumerates arrivals; tests separately check these identities and walk every
sector event.

Consequently the eight-sector full-track mean is 11.5 versus 8 ticks, not zero.
Its 1.4375 versus 1 revolution comparison uses discrete boundaries. A continuous
uniform-phase model instead gives a conventional full-track mean of 1.5
revolutions. Do not silently mix these phase conventions. A single-sector
request has no saving in this model.

Excluded: seeks, queuing, sector gaps, retries, controller processing, transfer
to the host, pre-existing cache hits, track crossings and hardware limits on
buffering. A full track here is a physical track, not any similarly sized LBA
range. Current devices may not expose or support the required geometry.

## Reproduce

Python 3 standard library, no downloads, no device access, no random seed:

    python3 model.py --check
    python3 -B -m unittest -v test_model.py
    python3 -O -B -m unittest -v test_model.py

To regenerate the JSON, run model.py without arguments and direct its standard
output to example.json. The recorded generation date identifies this fixed
example, not a claim of a fresh hardware observation.

## Reading

- [Ruemmler and Wilkes, IEEE Computer 1994](https://www.pdl.cmu.edu/Publications/HTML-Papers/DiskModeling/i.shtml):
  read caching and the historical use of the zero-latency name.
- [Griffin et al., FAST 2002](https://static.usenix.org/events/fast02/full_papers/griffin/griffin_html/index.html):
  section 6.1 and Table 5 separate emulated firmware benefits from application runtime.
- [Schindler et al., FAST 2004](https://static.usenix.org/events/fast04/tech/full_papers/schindler/schindler_html/index.html):
  sections 2.2 and 5 distinguish track alignment from arbitrary large requests.
- [Hesela HDD explanation](https://hesela.com/tech/hdd/) and
  [structured definition](https://hesela.dev/terms/read-on-arrival/).

The code and example were authored for this illustration. No paper text,
figures, vendor firmware or experimental traces are redistributed here.
