Copy-on-Write

Noun · Development

Definitions

  1. An optimization strategy where multiple references share the same data until one of them tries to modify it, at which point a copy is made for the modifier. Saves memory and CPU when copies are rarely modified. Used by Linux (fork()), Swift strings, Rust's Cow type, and filesystem snapshots (ZFS, Btrfs).

    In plain English: Sharing data between copies and only making a real copy when someone tries to change it — lazy copying.

    Example: "fork() uses copy-on-write — the child process shares the parent's memory pages until it writes to one, then only that page is copied."

Related Terms