- Process creation using the system call may initially bypass the need for demand paging by using a technique similar to page sharing.
- This technique provides for rapid process creation and minimizes the number of new pages that must be allocated to the newly created process.
- Recall that the system call creates a child process as a duplicate of its parent.
- Traditionally, worked by creating a copy of the parent's address space for the child, duplicating the pages belonging to the parent.
- However, considering that many child processes invoke the system call immediately after creation, the copying of the parent's address space may be unnecessary.
- Alternatively, we can use a technique known as copy-an-write, which works by allowing the parent and child processes initially to share the same pages.
- These shared pages are marked as copy-an-write pages, meaning that if either process writes to a shared page, a copy of the shared page is created (see Figs. 7 and 8).
Figure 7:
Before process 1 modifies page C.
|
Figure 8:
After process 1 modifies page C.
|
- Only pages that can be modified need be marked as copy-on-write. Pages that cannot be modified (pages containing executable code) can be shared by the parent and child.
- Copy-on-write is a common technique used by several OSs, including Windows XP, Linux, and Solaris.
Cem Ozdogan
2010-04-27