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

Rogelio Serrano rogelio at smsglobal.net
Tue May 4 08:48:57 UTC 2004


On 2004-05-04 16:31:18 +0800 Erik Andersen 
<andersen at codepoet.org> wrote:

> 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--
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc
> 

Are there other ways to implement fork? Like copy the process 
image and then relocate?




More information about the uClibc mailing list