[uClibc] vfork() wrapper in libpthread: BAD!

Erik Andersen andersen at codepoet.org
Tue May 4 08:31:18 UTC 2004


On Tue May 04, 2004 at 09:30:25AM +0530, Sajeev Kesavan wrote:
> 
> Hi, 
> 
>  To implement a fork through vfork : the parent process
>  needs to be in wait state until the _exec of the child is called..
>  Now this is as the theory goes for vfork().How can we go about
>  implementing the fork() through vfork() as fork() can have the
>  instances of parent in parallel to that of child...

I'm not quite certain what you are trying to say, but I am very
confidant in saying that, no, you cannot properly implement
fork() using vfork().  When you use vfork, the parent blocks till
the child exec's or exits, and both processes share the same
address space, which means you do not get COW as you do with
fork.  Any changes made to any variable or memory address in the
chile also changes the parent.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list