Skip to content

Archive

Fork

3 articles
Linux 23 Sep 2026 3 min read

MADV_WIPEONFORK Replaces Inherited Private Memory with Zeroes

MADV_WIPEONFORK Replaces Inherited Private Memory with Zeroes A normal fork() gives the child mappings derived from the parent’s address space, with private writable pages commonly handled through copy-on-write. MADV_WIPEONFORK changes that inheritance rule for a selected private anonymous range: the mapping remains present in the child, but its contents are zero-filled there. The parent keeps its existing bytes. The operation therefore changes child-visible memory at the process-creation boundary rather than erasing the parent’s range.

Linux 23 Sep 2026 4 min read

MADV_DONTFORK Excludes Memory Ranges from Child Address Spaces

MADV_DONTFORK changes a specific part of Linux process creation: a mapping marked with this advice is not made available in the child created by fork(). The parent keeps the mapping. The child starts without that address range, so an address that was valid there in the parent is not automatically valid in the child. This is a semantic control over mapping inheritance, not a cache hint. It belongs to the Linux-specific madvise() operations whose effects can change memory behavior.

Tech 23 Sep 2026 5 min read

Linux fork Uses Copy-on-Write to Delay Private Page Copies

fork() creates a new process with a virtual address space derived from the caller, but Linux does not need to duplicate every private physical page at the instant the syscall returns. For ordinary private writable mappings, the kernel can arrange parent and child page tables so both processes initially refer to the same physical memory while writes are constrained by copy-on-write state. This design makes process creation proportional to page-table and kernel bookkeeping rather than to the full amount of resident private data. Physical copying is deferred until a write requires the two address spaces to diverge.