[Info-vax] Looking into C-include files on VMS
Joerg Schilling
js at cs.tu-berlin.de
Thu Nov 5 09:28:03 EST 2009
In article <4cf9c37a-50d4-406a-8ee5-54420307ea93 at 31g2000vbf.googlegroups.com>,
MetaEd <metaed at gmail.com> wrote:
>On Nov 4, 2:56 am, glen herrmannsfeldt <g... at ugcs.caltech.edu> wrote:
>> As it is rare that you want to share the variables and open files,
>> and most common to exec(), vfork() was added.
>
>vfork() was never more than a kludge to get around the the lack of
>copy on write pages that originally slowed fork() down. fork() has
>been fixed, and vfork() is often just a wrapper around fork().
vfork() was, when it has been introduced by BSD UNIX around 1979, a bad
hack for shell performance. It's man page had a note from the beginning
that vfork() will disappear soon once a copy on write fork() is ready. This
copy on write fork() was introduced in 1987 by SunOS-4.0 (8 years later).
vfork() has not been removed. Now we have 2009 - 30 years after introducing
vfork() and 22 years after a copy on write fork() war introduced. vfork()
is still a bit faster as vfork() "borrows" MMU entries while fork() creates
new MMU PTEs. The fact that several shells use the side effect of the
real vfork() to allow shared memory between child and parent for sending
the results from the $PATH-search back to the paren shell results in
a fear from removing vfork().
>It is common to fork() and never exec(). In network programming, a
>server process will take the next connection request off the queue,
>call fork(), and go back to listen for the next request. The child
>handles the request from start to finish and then exits. You see this
>in web servers, mail servers, name servers, any type of network
>service where you listen for connections.
For a long time, there was no real portable replacement for fork, but
now there is pthreads available on most platforms and many applications
seem to be happy with pthreads too.
>vfork() does not avoid sharing of variables. It's the opposite. vfork
>() maps the child's data space to the parent's data space, letting the
>child modify the parent. fork(), on the other hand, duplicates the
>data space and gives the duplicate to the child.
See my note above.
--
EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js at cs.tu-berlin.de (uni)
joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
More information about the Info-vax
mailing list