October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Why fork() Doesn’t Copy Every Page: Copy-on-Write and Page Tables

Linux fork() gives the child separate memory mappings without eagerly copying every page. Copy-on-write makes a private page copy only when one process writes to a shared page.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Linux, fork() gives the child a separate address space whose initial memory contents match the parent’s, but it does not immediately copy every physical memory page. Instead, the processes’ separate page tables can map corresponding virtual pages to the same physical frames. If either process writes to a page still shared this way, the kernel copies that page for the writer and updates its mapping. The result is independent process memory, with page copying deferred until a write makes it necessary.

What “doesn’t duplicate memory” means

The shorthand in the title needs one qualification: Linux does create a child task and duplicate the parent’s page-table structures. What it defers is copying the contents of every mapped physical page. The Linux fork(2) manual describes the implementation as copy-on-write (COW), contrasting its fork-time cost with eagerly copying all pages.

As an Amazon Associate I earn from qualifying purchases.

That distinction matters because a page table is not the memory it describes. It is a mapping from a process’s virtual addresses to physical frames. The parent and child have separate page-table structures, but entries for corresponding virtual pages may initially point to the same physical frame.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How copy-on-write works after fork()

  1. Before the call: The parent’s page table maps a virtual page to a physical frame, which contains that page’s data.
  2. After fork(): The child has its own address space and page table. Corresponding entries in the parent and child can refer to the same frame, with write protection used to detect an attempt to modify the shared page.
  3. On a write: The CPU’s memory-management hardware reports a page fault when a process tries to write to the protected page. The kernel handles the fault, makes a private copy of the page for the writer, and changes that process’s mapping to the new frame.
  4. After the copy: The other process continues to map the original frame. Each process can then change its own page independently.

The Linux kernel’s page-table documentation explains virtual-to-physical translation, the MMU and translation lookaside buffers (TLBs), and page faults. Michael Kerrisk’s The Linux Programming Interface describes the specific COW sequence: the shared page is copied for the process that writes it, and that process’s mapping is updated.

What if neither process writes to a page?

No private copy of that page is needed while it remains shared. If a process writes first, that process receives the private copy; the same mechanism applies whether the writer is the parent or the child. Pages that neither process writes can remain physically shared while both use them.

What does fork() cost?

The Linux man-pages project’s fork(2) page, version 6.19, dated 2026-06-05, says: “Under Linux, fork() is implemented using copy-on-write pages, so the only penalty that it incurs is the time and memory required to duplicate the parent’s page tables, and to create a unique task structure for the child.” This describes the benefit at the time of the call compared with eagerly copying page contents; it does not mean fork() is free.

If the processes later write to many shared pages, the kernel must handle the resulting faults and copy those pages. How much work is deferred depends on which pages are written, and the cited sources do not establish a universal speedup or memory-saving percentage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What memory does the child inherit?

These implementation details are Linux-specific; POSIX defines observable process behavior without requiring Linux’s particular COW implementation. POSIX says the child has its own copy of the parent’s mappings. For MAP_PRIVATE mappings, changes made before fork() are visible to the child, while changes made afterward are visible only in the process that made them. That describes the processes’ behavior, not whether their physical pages are shared.

Linux also documents exceptions to ordinary inheritance: mappings marked MADV_DONTFORK are not inherited, and ranges marked MADV_WIPEONFORK are zeroed in the child. So it is not accurate to say every mapping is inherited with identical contents in every case.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Page-table levels are not the same as copied memory

The Linux kernel documentation describes a five-level page-table traversal in generic code, while noting that architectures can fold levels they do not use. That number is a detail of Linux’s generic page-table model, not a claim that every processor uses five physical levels. In either case, page-table structure and page contents are distinct: copying or setting up mappings is different from copying the data pages those mappings reference.

Quick Recap

Bestseller No. 1
SaleBestseller No. 2
Bestseller No. 3
SaleBestseller No. 4
SaleBestseller No. 5

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.