◀ THE FOLD0ROOT.AI // WORLD II · CO-OP · SHARED MEMORY◆ .dlw.fold
THE FOLD / CO-OP / SHARED MEMORY / THE COPY ON WRITE

THE COPY ON WRITE

the bill arrives later, addressed to someone else
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
A process forks and its whole address space is duplicated — except nothing is copied. Both processes point at the same pages, every page is marked read-only, and the copy happens on the first write, one page at a time, or never.

LIT verified live. A 1,024-page parent forks. All 1,024 pages are read: 0 copies. 37 pages are then written: exactly 37 copies, one per page, no more. Writing those same 37 pages a second time produces 0 further copies — the page is already private and the trap is gone. Resident memory is 1,061 pages against 2,048 for an eager copy: 48.2% saved, and the saving is proportional to what you did not touch.
2 HOW IT WAS WEAVED · AI + HUMAN
Copy-on-write reached Unix through TENEX and then Accent and Mach; it is why fork() followed by exec() is not absurd, which is the case it was built for.

AVAN (AI) checked the three separate claims that get bundled into one sentence. Reads never fault — 0 of 1,024. Writes fault exactly once per page — 37 of 37. And the second write to a copied page does not fault, which is the one people forget and the one that makes the amortised cost sane: the mechanism disarms itself as it is used.
3 ONE DIMENSION
1,024 pages after the fork. Shared until written.
4 TWO DIMENSIONS · INTERACTIVE
Read and write pages. Only writes cost anything.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: two address spaces over one memory.
AVAN’s addition (the inverse-companion): the forward reading is that copy-on-write makes fork cheap. The inverse is that it makes fork cheap and makes its cost unknowable. The bill is not presented at the call; it arrives later, page by page, charged to whoever happens to write first — and a process can be killed for memory it appeared to acquire at a moment when nothing was allocated. Read backwards, the saving of 48.2% is really a deferral, and deferral moves cost from a place you can measure to a place you cannot. The fork did not become free; it became untraceable.
LIT a 1,024-page parent forks; all 1,024 pages are read for 0 copies, then 37 pages are written for exactly 37 copies, one per page and no more, and writing those same 37 a second time produces 0 further copies because the page is already private and the trap is gone - resident memory is 1,061 pages against 2,048 for an eager copy, 48.2% saved

FIG Copy-on-write reached Unix through TENEX and then Accent and Mach; it is why fork() followed by exec() is not absurd, which is the case it was built for. AVAN checked the three separate claims that get bundled into one sentence: reads never fault, 0 of 1,024; writes fault exactly once per page, 37 of 37; and the second write to a copied page does not fault, which is the one people forget and the one that makes the amortised cost sane - the mechanism disarms itself as it is used.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SHARED MEMORY · David Lee Wise (ROOT0), with AVAN