Using vfork() -vs fork()

Ken Lee klee at gilroy.pa.dec.com
Fri Aug 18 08:23:06 AEST 1989


In article <1989Jun19.013230.16107 at marob.masa.com>, daveh at marob.masa.com (Dave Hammond) writes:
> Can someone provide concrete examples of where I'd want to use vfork(),
> rather than fork()?

vfork is intended specifically for the case where the child process
will exec soon after the vfork.  The parent process is suspended in the
interim.  A quick exec is common (most of the time), so this
performance hack is useful.

In their book, Leffler, et al, say:  "Although allowing modification of
the parent's address space is bad programming practice, some programs
have been known to take advantage of this quirk."  You can play games
with the parent during a vfork, but this is rarely worthwhile.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee at decwrl.dec.com
uucp: uunet!decwrl!klee



More information about the Comp.unix.questions mailing list