Precise exceptions: finishing is not committing
Explain how speculative results can finish early while retirement maintains an ordered architectural boundary.
On this page
The question for today
What you’ll understand
- Distinguish instruction execution, retirement, and store visibility.
- Trace a fault with completed younger speculative instructions.
- Explain what architectural precision guarantees and what it does not.
An operation can have a computed result without that result being part of the committed program state. That distinction enables out-of-order execution while supporting understandable faults and interrupts. Retirement is the point at which instructions become architecturally accepted under the implementation’s ordering mechanism. This lesson uses a simple reorder-buffer model and ordinary faulting instructions; exact exception classes, saved addresses, and special instruction behaviors remain architecture-specific.
Maintain a recoverable program-order boundary
A common out-of-order design keeps records of in-flight instructions in program order. Execution can finish younger ready work before an older stalled operation, but retirement advances from the oldest eligible instruction. If an older ordinary load faults, younger computed register results must not survive as committed program results. The exception handler sees a state corresponding to a precise architectural boundary, rather than an arbitrary mixture determined by execution-unit completion times. The exact saved instruction address follows the fault’s documented architectural rules.
An exception discovered during execution can therefore be recorded and handled when the instruction reaches the retirement boundary. This also prevents a fault on a discarded wrong path from behaving like a committed faulting instruction. Do not generalize the teaching model to every interrupt, trap, machine check, or partially completing instruction. Architecture manuals distinguish exception categories and specify restart behavior. The key mechanism is enough bookkeeping to decide which results belong to the accepted path and which must be discarded.
A store has several meaningful milestones
A store may calculate its address and data before retirement, then wait in structures that preserve ordering and permit recovery. Committing the instruction does not necessarily mean its bytes are already globally visible to every other core. Store buffering, coherence, and the architecture’s memory-order rules determine the visibility story. Likewise, retiring a load does not mean every cache or translation structure has returned to its prior state. Distinguish committed architectural values from internal state changes when discussing speculation.
A precise exception is therefore a functional state guarantee, not a promise that speculative work left no measurable trace. A cache line fetched on a wrong path can affect later access time even though the corresponding instruction did not retire. Side-channel defenses require their own documented mechanisms and threat model. Separately, persistence to nonvolatile media is another milestone beyond ordinary store visibility. Using the word committed without specifying the layer can accidentally collapse CPU retirement, inter-core communication, and durable storage into one false guarantee.
Inspect the boundary instead of the finishing order
For a short trace, list instructions in program order and separately mark operand readiness, execution completion, detected faults, and retirement. When the head cannot retire, a younger completed result does not authorize jumping the boundary. On a fault, remove younger speculative results from the architectural continuation according to the documented rules. A debugging register dump then becomes understandable: it describes an accepted boundary, not a photograph of every physical register and cache transaction inside the machine.
The queue lab has four units of initial backlog and arrivals and service controlled by λ and μ. Use it to predict how a backlog changes when admission outruns service, as an analogy for a finite in-flight window waiting behind a bottleneck. It does not contain instructions, faults, or a reorder buffer. In particular, its fluid service rule does not implement ordered retirement. Keep the actual fault trace on paper so the analogy cannot replace the mechanism that makes precise recovery possible.
Work it through
A younger result must not escape a fault
Three ordinary instructions are in program order: I1 adds 2+3, I2 loads from an inaccessible page, and I3 independently adds 8+1. Suppose I3 finishes before I2’s fault is handled.
I1 computes five and, once eligible, retires. Its result belongs to the accepted program prefix before the faulting load. I3 may compute nine internally while I2 is still pending.
When I2 reaches the relevant retirement boundary with its recorded page fault, normal retirement cannot accept I3 as if I2 had succeeded. The handler is entered with the architecturally defined fault state and saved instruction information.
The younger speculative result nine is discarded from the committed continuation. A handler may repair the mapping and restart according to the architecture, but that is a new continuation; I3’s earlier physical execution is not permission to expose its register result early.
Completion order can be I1, I3, I2-detects-fault while the accepted prefix still stops before I2. The fault trace is precise at the architectural level.
The living notebook
Explore the model
Interactive lab · queue
Admission can outrun an ordered bottleneck
Explore fluid arrival rate λ and service rate μ, predicting backlog change before playback. This is only an in-flight-capacity analogy; the lab has no ordered instruction records, exceptions, retirement, or store visibility.
- Fluid backlog
- 4
- Net rate · λ − μ
- −1 /s
- M/M/1 mean residence
- 1 s
Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA backlog model explains capacity pressure, while precise recovery requires a separate ordering mechanism.
Pause & reason
Check your understanding
Your turn
Try it yourself
A teaching machine dispatches 12 instructions. Seven retire, three younger wrong-path instructions are squashed, and no other instruction leaves the window. How many remain pending, and does that count reveal global store visibility?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Partition the same instruction population into retired, squashed, and pending categories.
Compare with the solution
Two remain pending: 12−7−3=2. The count concerns instruction bookkeeping only. It does not identify which retired instructions were stores or whether their bytes have become visible to another core, let alone persistent.
Keep the idea
Take it with you
- Execution can finish before retirement accepts a result.
- Precise recovery preserves an architectural boundary despite speculative work.
- Retirement, global visibility, and persistence are different milestones.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.