vfork() (was Re: RS6000 questions/comments)

Theo de Raadt deraadt at cpsc.ucalgary.ca
Sun Jun 30 20:13:22 AEST 1991


In article <19445 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
> In article <DERAADT.91Jun30030305 at fsa.cpsc.ucalgary.ca> 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.
 <tdr.
--

SunOS 4.1.1: /usr/include/vm/as.h, Line 49    | Theo de Raadt
typo? Should the '_'  be an 's'??             | deraadt at cpsc.ucalgary.ca



More information about the Comp.unix.aix mailing list