What is vfork ?
- It’s a special case of a clone. It is used to create new processes without copying the page tables of the parent process.
- calling thread is suspended until the child call
execveor_exit.
Points To Remember
vfork()is an obsolete optimization.- Before good memory management,
fork()made a full copy of the parent’s memory, so it was pretty expensive. - since in many cases a
fork()was followed by `exec(), which discards the current memory map and creates a new one, it was a needless expense. - Nowadays,
fork()doesn’t copy the memory; it’s simply set as “copy on write”, sofork()+exec()is just as efficient asvfork()+exec() - Some OSs,
vforkshares same address space as of parents vfork&forkinternally calls clone
Example
| |