vfork() is a C function available on many Unix-like systems to fork a process. There are strict rules about what you can do in the child process. It was part of POSIX (Single Unix Specification) in the 1997 and 2004 editions (marked 'obsolescent' in POSIX 2004), but it is not a part of POSIX 2008 (2016).
The vfork()
system call was added to BSD systems in the days before ubiquitous paging and copy-on-write techniques. It avoided having to replicate the entire image of the process and worked well as long as the next operation was one of the exec*()
functions or _exit()
.
These days, there is little benefit to using vfork()
. Kernels still need custom implementations of vfork()
because the memory management of vfork()
is different from fork()
— the vfork
ed child can (but should not!) modify the parents variables, file descriptors, etc., which is not possible with fork()
.