vfork() (was Re: RS6000 questions/comments)
Dennis Ferguson
dennis at gpu.utcs.utoronto.ca
Mon Jul 1 05:01:47 AEST 1991
In article <19439 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
>In article <889 at rufus.UUCP> drake at drake.almaden.ibm.com writes:
>>The RISC System/6000's fork() implementation is quite efficient, making
>>"vfork" unnecessary for performance reasons. Nonetheless, vfork() *is*
>
>I don't know what you call "particularly efficient", but I have measured
>fork/exit performance and AIX v3 is worse than SVR1 on a 12MHz 68000 that
>I tested in 1986. As I recall a S/6000 Model 530 produced about 8 or 10
>fork/exits per second, compared to about 45 per second on an Mpulse/XL
>that I was testing for my employer in 1986 (Pinnacle Systems, Inc.,
>Garland TX)
I'm not sure about "8 or 10 fork/exits per second", but I do know that
inverted page tables and segments make a copy-on-write fork() quite
difficult and expensive to implement. For the RT it was easy to write
a program which ran under Mach (full copy-on-write fork()) at about 5%
of the speed that it would under AOS (traditional copy-all-data fork()).
Page tables are global, rather than per-process, on the RT and the
RS/6000, and memory sharing is done by segments rather than pages. This
makes it nearly impossible to avoid rewriting the (global) page tables
during process switches if you are doing copy-on-write forks, and this
can be very expensive particularly if both the parent and child continue
running after the fork(). This, by the way, is a reason why one might
wish to let the child run first after a fork(). You can save yourself
a lot of grief if the child has the decency to exit() or execve() quickly
after the fork(), this avoiding the expensive process switches between
child and parent altogether.
I have no idea what AIX V3 actually does about this. There are
alternatives to pure copy-on-write (e.g. copy-on-access) which can save
some of the cost during process switches at the expense of other
tradeoffs. I do note, however, that while I agree that vfork() is
a hack, the traditional fork()/vfork() combination was indeed a good
match for what you can do easily on a machine with inverted page tables
and segments: copy all of the data segment or copy none of it. Whatever
IBM has done to make their fork() "efficient", I doubt that it is all
that "efficient" compared to machines which do copy-on-write with more
conventional memory management. Certainly the tradeoffs would be
different.
Dennis Ferguson
University of Toronto
More information about the Comp.unix.aix
mailing list