Simulate copy-on-write. Input: the number of pages of process P (frames 0 … n−1, one per page), then operations:
fork A B— process B becomes a child of A: B's page table is a copy of A's (frames are shared, their reference counts increase). Printfork A -> B: n pages shared read-only, 0 copied.X read k— printX read k: frame f.X write k— if X's frame for page k is shared (reference count > 1), copy it to a new frame (the next unused frame number), decrement the old frame's count:X write k: COW fault, copy frame f -> frame g; otherwiseX write k: frame f (private, no copy).
At the end print COW faults: c, pages copied: c, frames in use: u (frames with a count > 0) and Eager fork would have copied: e pages (t frames), where each fork would copy all n pages and t = number of processes × n.