Difference Between fork() and vfork()

MemoryOperating SystemComputers

In this post, we will understand the difference between system calls fork and vfork −

The ‘fork’ system call

  • In this system call, the child and parent process have separate memory spaces.

  • The child and parent process are executed simultaneously.

  • This call uses the copy-on-write as alternative.

  • Child process doesn’t have the ability to suspend execution of the parent process in this system call.

  • The page of one process doesn’t get affected by the page of other process.

  • It is more frequently used.

  • No address space is wasted.

  • If the child process alters the page in the address space, it is not visible to the parent process.

The ‘vfork’ system call

  • In this system call, the parent process and child process share the same address space.

  • Once the child process has been executed, the parent process begins the execution.

  • This system call doesn’t use copy-on-write technique.

  • The child process suspends the execution of the parent process in this system call.

  • The page of one process gets affected by the page of another process.

  • It is less frequently used.

  • No address space is wasted.

  • If the child process alters the page in the address space, it can be seen by the parent process.

raja
Updated on 20-Apr-2021 09:13:49

Advertisements