THE FOLD / RESPAWN / ROLLBACK / THE CONTEXT SWITCH
THE CONTEXT SWITCH
not the cost of switching, the cost of having been away
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Saving registers and loading the next process is the part of a context switch you can count. It is not the part that costs. The new process arrives to a cache full of somebody else’s data and has to earn its own back.
LIT verified live, on a stated model. Save/restore is a fixed 1; the working set is 64 units and refilling costs 0.5 each. Switch to a process that runs for 1 unit and the switch costs 1.5 — 150% of the work done. Let it run 256 and the same switch costs 33, which is 12.89% of the run, and 96.97% of that cost is cache, not registers. The direct cost never moved from 1.
LIT verified live, on a stated model. Save/restore is a fixed 1; the working set is 64 units and refilling costs 0.5 each. Switch to a process that runs for 1 unit and the switch costs 1.5 — 150% of the work done. Let it run 256 and the same switch costs 33, which is 12.89% of the run, and 96.97% of that cost is cache, not registers. The direct cost never moved from 1.
2 HOW IT WAS WEAVED · AI + HUMAN
The indirect cost dominating the direct one is the standard result; the numbers here come from a stated model, not from a measured machine, and the model is on the page so you can disagree with it.
AVAN (AI) is being explicit about that because it is the honest limit of this sphere. What is genuinely demonstrated is the shape: a fixed cost plus a cost bounded by how long you get to run means the penalty per unit of work falls with the run length, and no improvement to save/restore changes that.
AVAN (AI) is being explicit about that because it is the honest limit of this sphere. What is genuinely demonstrated is the shape: a fixed cost plus a cost bounded by how long you get to run means the penalty per unit of work falls with the run length, and no improvement to save/restore changes that.
3 ONE DIMENSION
Run length against what the switch really costs.
4 TWO DIMENSIONS · INTERACTIVE
Change the working set and see what registers are worth.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: arriving to someone else’s memory.
AVAN’s addition (the inverse-companion): the forward reading is that the cache refill is the hidden cost of switching. The inverse is that it is not a cost of switching at all — it is the cost of having been away. Nothing was spent at the moment of the switch; the process simply returns to a machine that has forgotten it, and pays on the way back in. Read backwards, that is why making the switch itself cheaper buys so little, and why the only real lever is the one the scheduler already holds: how long it lets anybody stay.
LIT on a stated model with save/restore fixed at 1, a working set of 64 units and a refill costing 0.5 each, a switch to a process that runs for 1 unit costs 1.5 - which is 150% of the work done - while the same switch before a run of 256 costs 33, or 12.89% of the run, with 96.97% of that cost being cache rather than registers, and the direct cost never moving from 1
FIG The indirect cost dominating the direct one is the standard result; the numbers here come from a stated model, NOT from measured hardware, and the model is on the page so you can disagree with it. AVAN is explicit about that because it is the honest limit of this sphere. What is genuinely demonstrated is the shape: a fixed cost plus a cost bounded by how long you get to run means the penalty per unit of work falls with the run length, and no improvement to save/restore changes that.
FIG The indirect cost dominating the direct one is the standard result; the numbers here come from a stated model, NOT from measured hardware, and the model is on the page so you can disagree with it. AVAN is explicit about that because it is the honest limit of this sphere. What is genuinely demonstrated is the shape: a fixed cost plus a cost bounded by how long you get to run means the penalty per unit of work falls with the run length, and no improvement to save/restore changes that.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of ROLLBACK · David Lee Wise (ROOT0), with AVAN