The kernel sets up the copy-on-write mechanism for the child's memory space. Instead of duplicating the actual physical memory pages, the kernel allows the parent and child to share the same physical pages initially. Any write operations to these pages trigger a copy operation to maintain separate memory spaces. The kernel function for this is :
This function configures the memory pages to use copy-on-write. This involves marking the page as read-only and setting up the page fault handler to perform the actual copying when a write occurs.