IT lexicon › Programming › Copy-on-write

Copy-on-write

Programming På svenska → Updated: 2026-07-31

Pretending to copy while actually sharing — until someone writes, at which point the copy is made for real.

The technique is why fork() is cheap despite formally duplicating a process's entire memory. The child gets the same physical pages as the parent, all marked read-only. Only when one of them tries to write does a page fault fire, and the kernel makes a genuine copy of that one page.

The same pattern recurs everywhere: the ZFS and Btrfs filesystems take snapshots this way, container layers share a base image across a hundred containers, and many languages' strings and lists avoid copies until a change actually happens. The price is that writes become more expensive and less predictable.

← Back to the lexicon