With vfork (and unlike fork) the address spaces of the two processes are exactly identical -- changing a value in one process will change the value in the other process as well, which is why the parent process is halted while the child is running, to avoid corrupting the stack.
For the record:
With "fork()" the address spaces initially are identically, too, so both processes will read the same values. But if one process writes to a memory location, the appropriate page will be copied. (This is called "lazy copy and to the user looks as if the complete address space had been copied to the child process already when doing "fork()"
Another difference is that the parent process is blocked until the child process does an *exec() (which now in fact provides a completely fresh memory to the child) or exits. So there is no chance that the parent process corrupts the child's memory.
This is why in many (but of course not all) cases fork() can simply be replaced by vfork() without the user program noticing.
-Michael _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev