Unix operating systems rely heavily on process creation to satisfy user requests. For example, the shell creates a new process that executes another copy of the shell whenever the user enters a command.
Traditional Unix systems treat all processes in the same way:
resources owned by the parent process are duplicated in the child
process. This approach makes process creation very slow and
inefficient, since it requires copying the entire address space of
the parent process. The child process rarely needs to read or modify
all the resources inherited from the parent; in many cases, it issues
execve( ) and wipes out the address
space that was so carefully copied.
Modern Unix kernels solve this problem by introducing three different mechanisms:
The Copy On Write technique allows both the parent and the child to read the same physical pages. Whenever either one tries to write on a physical page, the kernel copies its contents into a new physical page that is assigned to the writing process. The implementation of this technique in Linux is fully explained in Chapter 8.
Lightweight processes allow both the parent and the child to share many per-process kernel data structures, such as the paging tables (and therefore the entire User Mode address space), the open file tables, and the signal dispositions.
vfork( ) system call creates a process that shares the memory address space of its parent. To prevent the parent from overwriting data needed by the ...