Newsgroups: comp.unix.aix Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!cpsc.ucalgary.ca!deraadt From: deraadt@cpsc.ucalgary.ca (Theo de Raadt) Subject: Re: vfork() (was Re: RS6000 questions/comments) In-Reply-To: jfh@rpp386.cactus.org's message of 30 Jun 91 19:18:44 GMT Message-ID: Organization: U of Calgary, CompSci References: <1991Jun27.221208.14845@kithrup.COM> <8903@awdprime.UUCP> <351@devnull.mpd.tandem.com> <889@rufus.UUCP> <19439@rpp386.cactus.org> <19445@rpp386.cactus.org> Distribution: usa Date: 30 Jun 91 20:13:22 Lines: 47 In article <19445@rpp386.cactus.org> jfh@rpp386.cactus.org (John F Haugh II) writes: > In article I write: >>I'll bite and shove a vfork() in there instead of fork(). Here are >>times for a Sun4/490, sunos4.1.1. >> >> fork() 101.1 real 5.6 user 90.2 sys 99 fork/sec >>vfork() 9.7 real 0.5 user 6.5 sys 1030 vfork/sec >> >>I suggest those who say that vfork() is not needed anymore try this test >>on their machine. > >No, all you've managed to prove is that you have a future as a marketing >strategist ;-) > >This test is pretty meaningless when vfork() is used since vfork() does >nothing. For a really good time, try this one - That's exactly the point! vfork() does nothing, while fork() does lots of uneccesary work! vfork() does everything that a programmer would need a fork() to do in the case of exec() or exit() behaviour. Sticking an exec() in there makes your benchmark irrelevant; what you are doing is hiding the tiny little amount of time that it takes to vfork() or fork() with a large exec time. That is statistally misleading. Like the name of the book "Lying with statistics" :-). To make it accurate again, you would need to to remove the noise in the benchmark, subtract a loop of 10000 exec's(), only then could you determine how much work the fork() and vfork() has done, independently of the enormous exec time. That's not possible though. vfork() doesn't do one thing that fork() does which is needed by the exec() -- fork() allocate's a new upage (or equivelant) immediately, vfork() leaves this till exec time. In the case of exit(), it never gets allocated. Much as it's a crock, vfork() does indeed have advantages. All this talk about how COW and inverted page tables are so difficult suggests to me that the difference between fork() and vfork() on an AIX platform HAD THEY ADDED VFORK(), would have been much greater even than what I see on a Sun4/470. Probably more like 2500 vfork()'s per second.