[net.arch] vfork

dwc@hou2b.UUCP (D.CHEN) (09/16/86)

> Another case peculiar to Unix systems is VFORK. Why duplicate
> the whole address space when the most likely thing to do next
> is EXEC, which will clobber the space you just copied?

at&t demand paging versions of unix now default to this type of
fork.  the pages of private regions of a process' address space
are not copied on fork.  instead, they are marked copy-on-write
and any attempt to modify the pages by either the parent or the
child will result in a fault which will then copy the page for
the process.

but things are not as dandy as they seem.  there is not much savings
if the process (either parent or child) goes and attempts to modify
pages before the exec.  since most children are the ones to exec,
this can be "cured" by allowing the child to execute first after
the exec.  however, the child will modify a surprising number of pages
before it execs.  thus the copy-on-write fault handler overhead
can exceed the overhead of copying pages.  the benefits of this
type of fork is both system and "shell-dependent" (of course address
reordering of the shell may improve the situation).

danny chen
ihnp4!hou2b!dwc