Penguin
Note: You are viewing an old revision of this page. View the current version.

When you fork(2), or otherwise share some memory it takes a lot of time to copy the memory causing latency, and potentially wasting memory that could be shared. The idea of CopyOnWrite is to use the MMU to mark a region of memory readonly, when something attempts to write to this memory it causes a processor exception to be generated, this exception then copies this page (usually 4k on Intel). In particular after fork(2), it's very common to exec(2)?, throwing away all the memory that would have been copied.