# PCM preemption: the time saved by a read has to come from somewhere

Hesela's constructed example distinguishes read waiting, repeated programming work,
write completion and total elapsed time. It is exact arithmetic for a deliberately
small model, not a benchmark, device simulator or replication of a paper.

## The example

One write starts at time 0 on one bank and needs three iterations of four time
units. A read of a different line arrives at time 5 and needs two time units.
There are no other requests and switching has zero cost. The time unit is
abstract: these are not nanoseconds, measured cycles or vendor specifications.

| Policy | Read starts | Read latency | Write busy time | Write completes | Both complete |
| --- | ---: | ---: | ---: | ---: | ---: |
| Nonpreemptive | 12 | 9 | 12 | 12 | 14 |
| Cancel whole write | 5 | 2 | 17 | 19 | 19 |
| Pause at iteration boundary | 8 | 5 | 12 | 14 | 14 |
| Cancel current iteration | 5 | 2 | 13 | 15 | 15 |

Whole-write cancellation discards five units of progress. Iteration cancellation
discards only the one unit since the boundary at time 4. Pausing waits until time 8,
then preserves all completed work. The nonpreemptive write finishes first, but
its read waits longest. None of these columns can stand in for all the others.

In this model, with write work T, read work R and discarded work D, the final
completion time is T + R + D. Pausing changes the order without increasing total
work; cancellation adds repeated work. For a fixed two-request trace, completion
throughput is therefore 2 / (T + R + D). That is a property of this model, not a
claim that an application's speed cannot improve when a dependent read finishes
earlier. Closed-loop arrivals, bank parallelism and CPU stalls are outside it.

## Evidence and scope

Qureshi, Franceschini and Lastras-Montano's HPCA 2010 paper proposes cancelling
an in-flight PCM write or pausing between programming iterations to serve a read.
The correct pending value remains in the write queue; matching reads use that
queue. Section 6 combines pausing with cancellation of only the current iteration.
These are controller mechanisms, not transaction rollback or persistence barriers.
[Original paper](https://doi.org/10.1109/HPCA.2010.5416645).

Zhou, Zhao, Yang and Zhang study a different mechanism: overlapping operations
within a non-blocking PCM bank. Their 2014 paper distinguishes that parallelism
from preemption and evaluates scheduling under power constraints. Do not transfer
performance numbers between those architectures.
[Full paper](https://people.cs.pitt.edu/~zhangyt/research/tc2014.pdf),
[DOI](https://doi.org/10.1109/TC.2013.76).

Our four schedules are deliberately unconditional. We do not implement the
original paper's adaptive cancellation threshold, queue occupancy override,
variable iteration count, DRAM cache or application workloads. In particular,
the example is not a starvation-proof scheduler: it contains only one read.
No conversion from busy time to joules, wear or crash durability is justified.

## Reproduce

Use Node.js 22 or newer. No packages, network or random seed are required.

```sh
node model.mjs --check
node --test model.test.mjs
```

[Model](./model.mjs), [tests](./model.test.mjs), [machine-readable result](./results.json).
The tests compare the direct accounting against an independent unit-step oracle
over iteration vectors of lengths 1 through 4, with durations 1 through 3,
every integer read arrival from zero to write completion, read durations 1 through
3, and all four policies. Arrival exactly at a completed iteration discards no
part of that iteration; arrival at total completion cannot cancel the write.

## Provenance and reuse

Prepared 2026-11-29. The source papers were retrieved and reviewed, including
HPCA sections 3-7 and TC sections 1 and 7.4. No paper figure or full text is
redistributed. The example and code are original Hesela work, reusable under
[CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/).
Historical paper claims remain scoped to their simulated architectures.

Related definitions: [write cancellation](https://hesela.dev/terms/pcm-write-cancellation/),
[write pausing](https://hesela.dev/terms/pcm-write-pausing/),
[phase-change memory](https://hesela.dev/terms/phase-change-memory/).
