CS FundamentalsHardGATE CS

Copy-on-write after fork(): the parent has 1000 resident pages. The child immediately calls exec(). Roughly how many page copies does COW save compared with eager copying, and which pages are still copied?

  1. A. None; COW still copies all pages at fork()
  2. B. About 1000 copies are saved; only pages written before exec() (e.g. a few stack pages) get copied
  3. C. About 500; COW copies half the pages
  4. D. All 1000 pages are copied at exec() instead

Correct answer: B. About 1000 copies are saved; only pages written before exec() (e.g. a few stack pages) get copied

COW shares pages read-only and copies a page only when one side writes it. A child that writes almost nothing before exec() avoids nearly all copying; exec() discards the shared mappings anyway.

More Operating Systems questions

Exams that ask this topic