Copy On Write

The principle that you can efficiently share as many read-only copies of an object as you want until you need to modify it. Then you need to have your own copy.

Several optimizations exist; taking into account that a copy need not be made if an object isn't shared (i.e. you can mutate it in place).

CopyOnWrite works best when done with a GarbageCollector, and can interact with the GarbageCollector in many useful ways

This is typically used to efficiently implement fork() on modern Unices. The system call fork() makes a copy of the current process, but the new process doesn't actually get its own copy of a specific memory page until either the original or the new process attempts to write to such a page. Then, and only then, is the page copied.

Lots of OS memory management issues are handled using CopyOnWrite semantics; process creation is just one.

View edit of December 18, 2009 or FindPage with title or text search