Unix :Difference between fork() and vfork()?

The basic difference between the two is that when a new process is
created with vfork(), the parent process is temporarily suspended, and
the child process might borrow the parent's address space. This
strange state of affairs continues until the child process either
exits, or calls execve(), at which point the parentprocess continues.

This means that the child process of a vfork() must be careful to
avoid unexpectedly modifying variables of the parent process. In
particular, the child process must not return from the function
containing the vfork() call, and it must not call exit() (if it needs
to exit, it should use _exit(); actually, this is also true for the
child of a normal fork()).

No comments:

Post a Comment