# Frozen admission and the missing latency deadline

A frozen batch excludes new arrivals until its original requests finish.
That limits overtaking; it does not impose a workload-independent time bound.

## Historical mechanism

FSCAN freezes scan eligibility and holds later arrivals for the next scan.
This description follows section 2 of Seltzer, Chen and Ousterhout,
[Disk Scheduling Revisited](https://web.eecs.umich.edu/~pmchen/papers/seltzer90.pdf),
Winter USENIX 1990. It is a historical scheduling policy, not a current Linux
configuration recommendation.

## A small executable witness

The [model](model.py), [tests](test_model.py) and [generated result](result.json)
isolate admission. Both controls select the lowest position from the active
set, preserving admission order on ties. A new frozen batch begins another
ascending pass. There is no seek, rotation, end-of-scan travel, service-time
measurement or parallel device execution.

Initially near-0 at position 50 and far at position 90 are eligible.
Each near request produces one more at position 50 after completing, until
eight extra requests have arrived. Arrival triggers are completion events,
not a recording of wall-clock arrivals; both controls use this same rule.

| Admission | First three completions | Far completion ordinal |
|---|---|---:|
| Frozen | near-0, far, near-1 | 2 |
| Open | near-0, near-1, near-2 | 10 |

These are counts, not milliseconds or speedup ratios. The example is not a
full FSCAN simulator and does not reproduce the paper's performance results.

## What the finite-batch guarantee needs

If the current batch is finite and every request finishes in finite time,
new arrivals cannot prevent it from draining. With locally finite arrivals,
the next frozen batch is finite too. This is a conditional progress argument,
not a deadline proof; failed devices and infinitely stalled service violate it.

A counterexample to a universal time bound needs no complicated drive model.
Place k requests ahead of a tagged request in a frozen batch and assign each
request one synthetic service-time unit. The tagged completion is k+1:

| Requests ahead | Tagged completion (synthetic units) |
|---:|---:|
| 1 | 2 |
| 10 | 11 |
| 100 | 101 |
| 1000 | 1001 |

Increasing finite k gives arbitrarily large latency. A useful conditional
bound for a request in the next batch is R + B*S: R bounds the remaining time
of the active batch, B bounds the next batch's request count (including the
tagged request), and S bounds total per-request service cost. This also assumes
no extra unbounded idle periods or batch-transition costs. Admission limits
and device-service bounds must be established separately.

Finally, host selection order need not equal completion order:
[Linux 6.16 blk-mq documentation](https://docs.kernel.org/6.16/block/blk-mq.html)
explicitly separates staging, dispatch and tagged completion. The single-server
witness above does not model those concurrent stages.

## Reproduce

Requires Python 3.10+ and only its standard library. No input dataset, random
seed, network service or disk I/O benchmark is involved.

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

The result is deterministic. Tests include stable ties, all original requests
preceding later arrivals for 64 batch sizes, increasing backlog, malformed
inputs, unreachable/cyclic triggers, and an open-admission negative control.
The script does not issue storage commands or change scheduler settings.

[Canonical definition](https://hesela.dev/terms/fscan/).
