Two Pages Of Copying

A process maps 1 GiB of private anonymous memory and writes to all of it, so every page is resident. It then calls fork(). The child writes one byte at offset 0 and one byte at offset 700 MiB, then calls _exit.

Pages are 4 KiB and transparent huge pages are off. How many 4 KiB pages of that region does the kernel copy?

A

0, because the region is anonymous and has no file to copy back to

B

262144, all of them, at the moment fork() returns

C

2

D

262144, but lazily, spread over the child's lifetime as it touches them