CS FundamentalsModerateIBM · Deloitte pattern

Modern fork() implementations use copy-on-write. Which statement is correct?

  1. A. Only the stack is copied; heap and data remain shared
  2. B. Pages are shared read-only after fork, and a page is duplicated only when either process writes to it
  3. C. The entire address space is copied immediately, but lazily mapped
  4. D. Parent and child share all pages forever, so a write by one is seen by the other

Correct answer: B. Pages are shared read-only after fork, and a page is duplicated only when either process writes to it

After fork, both page tables point to the same frames marked read-only. The first write causes a protection fault, and the kernel then copies just that page. Semantics stay as if the whole space were copied.

More Operating Systems questions

Exams that ask this topic