scsh-users
[Top] [All Lists]

Re: fork vs. spawn

To: Paul Wilson <wilson@cs.utexas.edu>, scsh@martigny.ai.mit.edu
Subject: Re: fork vs. spawn
From: Richard Tobin <richard@cogsci.ed.ac.uk>
Date: Fri, 9 Aug 1996 13:18:46 +0100
Organization: just say no
> In most cases, I'd think you could do just as well to use a spawn()

Do you have a spec for spawn()?  People have suggested this in unix
newsgroups at intervals over several years, and discussions have
always foundered when it comes to the details.

For unix, the problem is that there is so much that you can do between
the fork() and exec() - shuffling file descriptors, changing
directory, (un)ignoring signals etc.  Do you build all these in as
arguments to spawn()?

Of course, these were discussions of *replacing* fork()/exec() in
unix.  Your goal is less ambitious, but how much would you want to do?
I would have thought that connecting pipes to the child's stdin/stdout
was necessary, but how do you do that if:

> you could have a little parent process that you ask to fork copies
> of itself when you want to spawn.

?

Given vfork() or copy-on-write fork(), implementing spawn()
straightforwardly with fork() and exec() (rather than a helper
process) is not as expensive as it used to be for large processes.
Indeed, wasn't one of the original motivations for vfork() to make
running processes from Franz Lisp cheaper?

-- Richard

<Prev in Thread] Current Thread [Next in Thread>