scsh-users
[Top] [All Lists]

Re: fork vs. spawn

To: scsh@martigny.ai.mit.edu
Subject: Re: fork vs. spawn
From: Sean Doran <smd@chops.icp.net>
Date: 10 Aug 1996 00:18:18 -0400
-----BEGIN PGP SIGNED MESSAGE-----

wilson@cs.utexas.edu (Paul Wilson) writes:

> No.  I'm trying to figure out what the spec should be, so that it's
> easily portable but still useful.

I'm still trying to figure out what you're trying
to do or accomplish which isn't handled by the (run) form
and its relatives.

(run (| (cat group) (grep wheel))) abstracts lots of
things enough that you don't really need a POSIX system
underneath.  However, alot of the stuff that uses the run
form in my experience is not easily portable to non-UNIX
systems, sometimes due to filenames, sometimes due to the
programs run invokes, and sometimes because UNIX-style
pipeline concurrency is really necessary for the task.

If one wanted to be sneaky, one could adjust the "path"
that (run) uses so that before execvp it would look for
a scheme function to use instead, and even have that run
within the parent process if it could be done hygenically
or if you the programmer decided its side-effects would be
"safe".

Other optimizations might be possible.  For instance:

(run (begin (run (begin (run (begin (run (ps))))))))

could be collapsed into a single (run (ps)), (or better
still, a call to a function ;> Think that's funny?  Think
of (run (date)) vs (date->string (date))), thus saving
yourself the multiple instances of scsh.

[FWIW, on even a relatively slow NetBSD-1.2_BETA machine,
I don't notice any human-troubling time difference between
running a form in one scsh and running a form buried in
several (run (begin (run (begin (...))))), thanks to a
copy-on-write fork.]

> (Another poster didn't seem to notice that my original posting was
> talking about faking spawn() on unix with fork() and exec() from
> a little server process that just forks the things that need to
> be spawned.)

If that's me, it's because I still don't understand what
you're trying to build.  Maybe you could explain it in
terms of an application?  That might help.

> One thing that would be good would be simple spawning of filter processes
> that you can pipe together.  Nothing fancy, just a filter. 

Like (run (| ...)) ?  Or something different?

        Sean.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: PGP Public Key in ftp://ftp.sprintlink.net/engineer/smd/pgpkey

iQCVAwUBMgwNaESWYarrFs6xAQEl8QP/clS/xh3vSzjWx+0dBCAIsLaKEMNGq4m/
ebXzuO/nTjwOfNUwJwdFbvDQqGwYfBrKkZqMeYposi9tgE5EZVMnvngbPxyNewAr
rHcDXT9so/+5UYhWuTTiGlwn8QmCzNEJQ4C8zNYR8EPNZXBBDUR601d1V6MZL+06
CmpKwelLXGg=
=Hos4
-----END PGP SIGNATURE-----

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