Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Newsgroups: comp.unix.aix Subject: Re: vfork() (was Re: RS6000 questions/comments) Keywords: compiler problems rs6000, vfork() Message-ID: <1991Jun29.072930.24674@kithrup.COM> Date: 29 Jun 91 07:29:30 GMT References: <1991Jun27.221208.14845@kithrup.COM> <8903@awdprime.UUCP> <351@devnull.mpd.tandem.com> Distribution: usa Organization: Kithrup Enterprises, Ltd. Lines: 31 In article <351@devnull.mpd.tandem.com> lance@mpd.tandem.com (Lance Hartmann) writes: >"...only legitimate use...child will execute before parent"??? The MAIN reason >to use vfork() is when it is desired to spawn a child that does nothing >but an execve(). With this scenario, it is unnecessary to copy the >address space of the parent, so using vfork() is much more efficient. Gee, on my system, which does not have vfork(), a fork() does not cause the address space of the parent to be copied. That's what COW is for. vfork() is a hack. Period. The history I have gotten was that it was done because the VAXen Berkeley had at the time were not completely capable of doing COW (bug in the microcode, apparantly), therefore, to ease fork()'s cost, they created a new system call. For extremely large processes, many processors and their implementations will have some problems with using COW forks that vfork() would handle. However, this need not be the case (I can think of a few tricks that can be done, and if you throw in hardware assist there are an amazing number of things you can do). >Also, don't forget to use _exit() (note the leading underscore '_') INSTEAD >of exit() in the event the execve() fails so that you don't hose the parent's >stdio. Yep. That's what happens when you use the hack vfork(). -- Sean Eric Fagan | "What *does* that 33 do? I have no idea." sef@kithrup.COM | -- Chris Torek -----------------+ (torek@ee.lbl.gov) Any opinions expressed are my own, and generally unpopular with others.