vfork():
The vfork() function is the same as fork() except that it does not make a copy of the address space. The memory is shared reducing the overhead of spawning a new process with a unique copy of all the memory. This is typically used when using fork() to exec() a process and terminate. The vfork() function also executes the child process first and resumes the parent process when the child terminates.
Example:
1 #include<stdio.h>
2 #include<unistd.h>
3 #include<stdlib.h>
4 int globalVariable = 2;
5 int main(){
6 char *sIdentifier;
7 int iStackVariable = 20;
8
9 pid_t pID = vfork();
10
11 if( pID == 0 ) {
12 //Code only executed by child process
13 sIdentifier = "Child Process: ";
14