CS FundamentalsHardTCS NQT · Infosys pattern

Copy-on-write (COW) is used after fork() to avoid copying the entire parent's address space immediately. How does it work?

  1. A. Both processes share the same physical pages marked read-only; a private copy of a page is made only when either process tries to write to it
  2. B. It copies all pages immediately but compresses them to save space
  3. C. It never actually copies anything, so writes by the child are visible to the parent
  4. D. It only applies to the stack segment, never the heap or data segment

Correct answer: A. Both processes share the same physical pages marked read-only; a private copy of a page is made only when either process tries to write to it

COW maps parent and child to the same physical frames, marked read-only. A write triggers a protection fault; the kernel then allocates a new physical frame, copies the page's contents, and remaps just that page for the writer — so unmodified pages (often most of them, especially before an exec()) are never duplicated.

More Operating Systems questions

Exams that ask this topic