-----BEGIN PGP SIGNED MESSAGE-----
richard@cogsci.ed.ac.UK (Richard Tobin) writes:
> Indeed, wasn't one of the original motivations for vfork() to make
> running processes from Franz Lisp cheaper?
Well, while this would not totally surprise me, I seem to
remember that the principal motivation was broken
microcode in the 11/780 that made people worry that
copy-on-write would be unreliable, combined with paging
thrash caused by the way fork worked on busy systems that
had memory overcommit, or on systems that had large
forking processes.
Essentially, under the old fork regime, the entire
process's address-space would be copied, which would
require all the pages to be fetched in from swap space as
necessary, and be copied. With large processes,
especially when both copies of the entire program wouldn't
fit in memory, this would lead to parts of the forking
or forked process already in memory to be paged out, not
to mention migrating parts or all of other processes to
get paged or swapped too.
This led to unusably thrashy machines in some cases.
Anyway, since COW was hard, vfork came about. vfork is
essentially designed around the observation that many
child processes did little other than munge signals and
maybe redirect I/O before calling some form of exec, while
the parent usually hung around on a call to wait.
Given a human could recognize this situation better than
the compiler or the kernel at the time, vfork was
implemented as a separate system call to be used in that
situation. And in precisely that situation, it was
incredibly efficient, involving essentially no memory copying.
The lack of memory copying also meant that the child could
side-effect the parent by changing its address space,
which is really ugly, and gone from MACH-based "vfork",
which is implemented in COW, just like fork is.
Anyway, whether it was Franz or EMACS or csh or any number
of memory pigs that forced the issue, there was always the
pain of memory-copying on fork from the old old days of
UNIX, which paging actually made worse rather than better.
vfork was a hack, but it sure did the trick of making the
huge majority of cases of process child-creation quick and
painless.
Sean.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: PGP Public Key in ftp://ftp.sprintlink.net/engineer/smd/pgpkey
iQCVAwUBMgv7DkSWYarrFs6xAQFtwAP+PFd0Tcb6Qn1ovkHNMWmaXwpkvEE5XAUn
zrtcmLTWsT8TFJjkukqvhOJecIwDYKN45cKmtLDD21Lsrxo8co/vr0T63RW7XO8J
iaCaMKRdp7y3lghstanSzWcwAiDKm6VAf5ogXfyH3NTvTqgiyczGMalmCZdiuhZq
n60+l/yvlZc=
=wECm
-----END PGP SIGNATURE-----
|