Help Measuring Fork/Exec Overhead

Guy Harris guy at sun.uucp
Wed Aug 28 16:09:07 AEST 1985


> > ... there's not much point in copy-on-write if the
> > smallest unit that can be mapped is an entire segment).
> 
> I don't see that.  Most fork()s are almost immediately followed
> by exec(), so that avoiding the useless copying of data segments
> still seems like a big win.

You'll still copy the stack segment, as a bare minimum.  If "exec" touches
the data space in any way, you copy it too.  (Yes, there are systems where
"exec" touches the data space - the PDP-11's system call sequence didn't
involve parameters pushed onto the stack, so they had to be put into a
static area instead.  Also, if you "exec" a lot of shell files and don't
have a system whose kernel can detect that and run a shell (i.e., the
4.xBSD/V8(?) #! stuff), the first "exec" will return an error code, stored
in "errno" - blammo, time to copy the whole data segment.)

	Guy Harris



More information about the Comp.unix.wizards mailing list