Using vfork() -vs fork()

Mats Wichmann mats at oblio.UUCP
Fri Jun 30 04:10:21 AEST 1989


daveh at marob.masa.com (Dave Hammond) writes:

>Can someone provide concrete examples of where I'd want to use vfork(),
>rather than fork()?

When you know you are going to do an exec() right away.  Which the Berkeley
people argue (correctly) is a very frequent use for fork().  The issue is
that copying the process space of the parent to make the child seems like a
lot of work if you are going to throw it away by exec'ing another program
right away.  So vfork() shares the addresses spaces instead of making a
copy.  Making the child copy-on-write is another way to accomplish this
(transparently), as in Sys V.3, but there you still pay the costs to set up
the table structures.  Another way is to get real virtual memory (Mach
claims to do this stuff better, for example).

Mats Wichmann
Acer America



More information about the Comp.unix.questions mailing list