# Mean cost is not the probability of being faster

A lower expected cost need not identify the option that wins most often.
This exact, synthetic next-request example isolates that distinction.
It is not a Disk Mimic implementation, performance replication or measurement.

## A fully specified example

Both choices face the same hidden state. A costs 1 ms with probability 2/5
and 9 ms with probability 3/5. B costs 6 ms in either state.
The choice does not change the probability distribution.

| Criterion | A | B | Choice |
| --- | ---: | ---: | --- |
| Mean cost | 29/5 ms = 5.8 ms | 6 ms | A |
| Probability of being strictly faster | 2/5 | 3/5 | B |

The mean calculation is (2 x 1 + 3 x 9) / 5 = 29/5.
A state-aware oracle would choose A in the fast state and B in the slow state,
costing (2 x 1 + 3 x 6) / 5 = 4 ms on average. Its advantage over the best fixed
choice is 9/5 ms. The oracle has extra information, so this is not an attainable
improvement attributed to a scheduling algorithm.

For an arbitrary fast-state probability p, A has mean 9 - 8p. Its mean beats
6 when p > 3/8, whereas its chance of being faster exceeds B's only when
p > 1/2. Thus 3/8 < p < 1/2 is the exact disagreement interval. Boundary
ties and deterministic endpoints are included in the generated controls.

## Why this belongs next to Disk Mimic

The historical model supplies predictions to SMTF; the model and scheduler
are not synonyms. [1] The dissertation's application-specific feature selection
is a useful reminder to state what information a prediction conditions on. [2]
Our example illustrates a decision-objective distinction, not a defect in
that published system.

Nothing here models mechanical geometry, cache state, training error,
interpolation, queue arrival, changing head position or fairness. It cannot
estimate workload throughput or tail latency. No population was sampled:
the stated probabilities are assumptions, so empirical confidence intervals
would be inappropriate.

## Reproduce

Python standard library only; no random seed or external data.

```sh
python3 model.py
python3 model.py --check
python3 -B -m unittest discover -s . -p test_model.py
python3 -B -O -m unittest discover -s . -p test_model.py
```

Download [model.py](model.py), [tests](test_model.py), [results](results.json)
and [source metadata](sources.json) into one directory. The test oracle explicitly
enumerates states for 5,150 numerator/denominator combinations. This count
describes test coverage, not independent observations.

## Primary sources

1. [Popovici, Arpaci-Dusseau and Arpaci-Dusseau, ATC 2003](https://research.cs.wisc.edu/adsl/Publications/usenix03-disksched.pdf),
   sections 2-6; publisher record in sources.json.
2. [Popovici, dissertation, 2007](https://research.cs.wisc.edu/wind/Publications/popovici-thesis07.pdf),
   chapters 2-3.

Reviewed 2026-12-02. Upstream PDFs are linked, not redistributed.
The code and calculations above are original Hesela teaching material.
