Using vfork() -vs fork()

R.HUTCHISON hutch at lzaz.ATT.COM
Tue Aug 22 23:00:43 AEST 1989


>From article <3161 at cbnewsh.ATT.COM>, by dwc at cbnewsh.ATT.COM (Malaclypse the Elder):
> 
> in unix system v release 4, fork will have all the advantages
> of vfork with none of the disadvantages (well almost).
> 
> danny chen
> att!hocus!dwc

I think that SVR3 has these advantages already plus more.  
V.3 has copy-on-write (COW) pages, allowing parent and child to 
change the same image (by default).  So, if the child does an 
exec() right away, the two are similar (in the amount of work the OS
has to do).  But... V.3 has extra goodies...

1) The SVR3 child does not have to obey the rules a vfork() child does - it
can change the process image - whenever a change is made, the changing
process (whomever it might be) gets its own copy of the page it
changed - the rest remains shared.  If a parent creates several
children (through fork()s) they will all share the same image until
one of them wants to change a page - then it will get its own copy and
the rest will still share the original page.

2) Unrelated processes share data pages as well as (the traditional)
text pages.  This is great if you have large static tables - they are
shared by all using the program.  The same COW principle applies.

Is there more that I'm missing?

Bob Hutchison
att!lzaz!hutch



More information about the Comp.unix.questions mailing list