Path: utzoo!attcan!uunet!cbmvax!jesup
From: jesup@cbmvax.UUCP (Randell Jesup)
Newsgroups: comp.sys.amiga
Subject: Re: Amiga UNIX
Message-ID: <4124@cbmvax.UUCP>
Date: 27 Jun 88 22:07:53 GMT
References: <1985@uhccux.uhcc.hawaii.edu> <4079@cbmvax.UUCP> <6811@cup.portal.com> <4112@cbmvax.UUCP> <2188@sugar.UUCP>
Reply-To: jesup@cbmvax.UUCP (Randell Jesup)
Organization: Commodore Technology, West Chester, PA
Lines: 33

In article <2188@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes:
>In article <4112@cbmvax.UUCP>, jesup@cbmvax.UUCP (Randell Jesup) writes:
>> 	All you need to do a fork() is to copy the data/stack segments on
>> task swaps between those two.

>cat file | while read FOO BAR JUNK; do frobb $FOO | baz $BAR; done | ...
>
>That 'while' (according to the docs: I haven't seen the Bourne shell source)
>runs in a forked subshell. Now all you have to do is stick this in the
>background, or do this twice, and you die die die die...

	The shell(s) are part of the system.  There are ways around it, of
course that requires mods to the shell.  So what?  It's user/application/pd/
whatever programs where this matters, since anything that's part of the system
can work around the slowness of fork()s that don't exec/exit.

	Also, most (99%? - don't flame, it's just a guess) of pipe invocations
don't involve the shell executing lots of subshells that don't exec.  In fact,
I think I've never done so.  So long as only one of the shell subprocesses is
actually doing any processing, there's no extra overhead.

>> Luckily, VERY few programs
>> fork without exec()ing or exit()ing soon thereafter (though they often
>> muck with fd's, etc first.)
>
>Yeh, the shell is the only one I can think of that I use often :->.

Like I said VERY few.  How many different shells do you run on your system?
2? 3?  How many of them are user-written programs (i.e. not obtained with the
system)?

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup