This preview shows page 1. Sign up to view the full content.
Unformatted text preview: handler returns, the CPU reexecutes the write, which now proceeds normally on the newly created page. By deferring the copying of the pages in private objects until the last possible moment, copy-on-write makes the most efﬁcient use of scarce physical memory. 10.8.2 The fork Function Revisited
Now that we understand virtual memory and memory mapping, we can get a clear idea of how the fork function creates a new process with its own independent virtual address space. When the fork function is called by the current process, the kernel creates various data structures for the new process and assigns it a unique PID. To create the virtual memory for the new process, it creates exact copies of the current process’s mm struct, area structs, and page tables. It ﬂags each page in both processes as read-only, and ﬂags each area struct in both processes as private copy-on-write. When the fork returns in the new process, the new process now has an exact copy of the virtual memory as it existe...
View Full Document
- Spring '10
- The American