vfork under 4.0

Guy Harris auspex!guy at uunet.uu.net
Thu Mar 23 04:13:45 AEST 1989


>Is there any reason to use vfork() under 4.0?

Yes - if you want your code to run with maximum efficiency on 4.xBSD
systems.  There is, I'm told, still a tiny performance improvement even in
SunOS 4.0, since it doesn't have to copy the data structures that define
the address space, nor does it have to mark all the copy-on-write pages as
non-writable (so it can take a trap and do the copy when an attempt is
made ot write them); however...

>Isn't fork just as efficient now that copy-on-write is implemented?

...it's probably efficient enough to render "vfork()" uninteresting if you
don't care about current 4.xBSD implementations.

>I see that the manual page still says "this system call will be
>eliminated when proper system sharing mechanisms are implemented".
>Is this just an anachronism, or a subtle attack on the 4.0
>implementation?

It's an anachronism, left over from the 4.xBSD manual pages.  Berkeley's
looking to implementing "proper system sharing mechanisms" in a future
release; I don't know if they'll nuke "vfork()" or not, however, since
there appear to be some disgusting programs that actually bogusly *use*
the memory-"sharing" "semantics" of "vfork()".  That's the main reason
"vfork()" isn't just a synonym for "fork()" in SunOS 4.0.  Berkeley might
just make it such a synonym in a future release, though, so if you've got
any such gross code, fix it now, before the fewmets hit the windmill....



More information about the Comp.sys.sun mailing list