Next: Creating Processes
Up: Process Control
Previous: Process Control
Contents
- Table 4.1 attempts to summarize how process attributes are shared, copied, replaced, or separate for the four major ways to change a process.
- Instead of actually copying memory, a feature known as "copy-on-write" is frequently used in modern OSes like Linux.
- The mappings between virtual and physical memory are duplicated for the new process, but the new mappings are marked as read-only. When the process tries to write to these memory blocks, the exception handler allocates a new block of memory, copies the data to the new block, changes the mapping to point to the new block with write access, and then resumes the execution of the program.
- This feature reduces the overhead of forking a new process.
Table 4.1:
Process Attribute Inheritance
| Attribute |
fork |
thread |
clone |
execve |
| Virtual Memory |
|
|
|
|
| Code Segment |
copy |
shared |
CLONE_VM |
replaced |
| Const Data Segment |
don't care |
shared |
CLONE_VM |
replaced |
| Variable Data Segment |
copy |
shared |
CLONE_VM |
replaced |
| stack |
copy |
separate |
CLONE_VM |
replaced |
| mmap |
copy |
shared |
CLONE_VM |
replaced |
| brk |
copy |
shared |
CLONE_VM |
replaced |
| command line |
copy |
shared |
CLONE_VM |
replaced |
| environment |
copy |
shared |
CLONE_VM |
replaced |
| Files |
|
|
|
|
| chroot, chdir, umask |
copy |
shared |
CLONE_FS |
copy |
| File descriptor table |
copy |
shared |
CLONE_FILES |
copy |
| file locks |
separate |
separate |
CLONE_PID |
same |
| Signals |
|
|
|
|
| Signal Handlers |
copy |
shared |
CLONE_SIGHAND |
reset |
| Pending Signals |
separate |
separate |
separate |
reset |
| Signal masks |
separate |
separate |
separate |
reset |
| Process Id |
different |
different |
CLONE_PID |
same |
| timeslice |
separate |
shared |
CLONE_PID |
same |
Next: Creating Processes
Up: Process Control
Previous: Process Control
Contents
Cem Ozdogan
2007-05-16