[comp.std.c] fork/exec

henry@utzoo.uucp (Henry Spencer) (08/15/89)

In article <5672@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>Hmmm. Does POSIX specify that fork() is the process-creation mechanism?

Yes.

>... while the fork()-exec() pair is singularly elegant, it's not
>implementable (without a massive number of kludges) in a wide variety of
>operating systems: OS/9, VMS, RSX, AmigaOS...

The technical term for this is "tough luck".  POSIX is a *Unix* standard.
The inability of defective operating systems to emulate it was (a) well
known, and (b) not a consideration.

On the hardware used by VMS and RSX, it is verifiably possible to implement
fork(), since Unix runs on those machines.  The same is probably true of
the Amiga, given that the Amigoids assure us that the Amiga is superior
to the Atari ST in every way :-), and Minix does fork() just fine on the ST.
Dunno about OS/9, although given how much help Minix gets from the ST on
fork() -- none -- it ought to be practical on 6809s as well, given enough
memory.  So doing fork() for the "operating systems" you name is just a 
Small Matter Of Programming for their maintainers.

(That chortling sound you hear is all the Unix old-timers watching the
frantic scramble for Unix compatibility by all the people who spent
years sneering at Unix.  Nyah nyah, we told you so!  :-) :-) :-))
-- 
V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

peter@ficc.uu.net (Peter da Silva) (08/16/89)

In article <1989Aug15.012607.4529@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes:
> On the hardware used by VMS and RSX, it is verifiably possible to implement
> fork(), since Unix runs on those machines.

True. It's probably possible to implement fork() on the 8051-class chip
in your typical microwave oven. But quite irrelevant to the question of
using Posix as a way to fill in the gaps outside the scope of the C standard.

> (That chortling sound you hear is all the Unix old-timers watching the
> frantic scramble for Unix compatibility by all the people who spent
> years sneering at Unix.  Nyah nyah, we told you so!  :-) :-) :-))

I *am* a UNIX old-timer, Henry.  I'm just a little less parochial than
some.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Business: peter@ficc.uu.net, +1 713 274 5180. | "The sentence I am now
Personal: peter@sugar.hackercorp.com.   `-_-' |  writing is the sentence
Quote: Have you hugged your wolf today?  'U`  |  you are now reading"

chip@vector.Dallas.TX.US (Chip Rosenthal) (08/16/89)

henry@utzoo.uucp (Henry Spencer) writes:
>On the hardware used by VMS and RSX, it is verifiably possible to implement
>fork(), since Unix runs on those machines.

But it has been widely acknowledged here the biggest problem is getting
manufacturers to fix software which a standard of some sort breaks.

Process creation under VMS is indeed painful.  But doable.  After all,
David Kashtan was able to implement fork()/exec() in Eunice.  However,
some tricks were required to minimize the pain.  An exited process wasn't
thrown away, but kept around and recycled with a future fork().  This
alleviated the need to do a costly spawn with every fork().  Eventually,
unused processes which hung around long enough would be released.

An interesting side-effect (OK...maybe not pertinent...but interesting none
the less) was that at one time priviliges were maintained in the recycled
process.  The implications for things which looked like setuid programs
should be pretty obvious.

These comments based on my experiences with Eunice 4 years ago, I have
no idea if they are applicable to modern versions.  (I would certainly
hope the privs problem isn't!)
-- 
Chip Rosenthal / chip@vector.Dallas.TX.US / Dallas Semiconductor / 214-450-5337
"I wish you'd put that starvation box down and go to bed" - Albert Collins' Mom

gwyn@smoke.BRL.MIL (Doug Gwyn) (08/16/89)

In article <1989Aug15.012607.4529@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>(That chortling sound you hear is all the Unix old-timers watching the
>frantic scramble for Unix compatibility by all the people who spent
>years sneering at Unix.  Nyah nyah, we told you so!  :-) :-) :-))

Actually, I liked it better in the "old days" when UNIX was used only by
those who appreciated its virtues.  It's gotten rather warty since then,
and apart from the appearance of streams, not much has been done to
address its deficiencies with elegant solutions (as opposed to hacks).
At least now we have a standard for all the hacks!

eric@snark.uu.net (Eric S. Raymond) (08/16/89)

In <1989Aug15.012607.4529@utzoo.uucp> Henry Spencer wrote:
> (That chortling sound you hear is all the Unix old-timers watching the
> frantic scramble for Unix compatibility by all the people who spent
> years sneering at Unix.  Nyah nyah, we told you so!  :-) :-) :-))

Heh heh. As one who still remembers getting flamed by one of my father's
CompSci PhD friends for expressing an interest in UNIX shortly after reading
the CACM paper in 1973, I'll see that chortle and raise you one of my
patented `Mad Doctor Moebius' evil cackles.

Actually, I had no idea I'd eventually be making my living as an itinerant
UNIX wizard way back then...I was all of 16 then and thought I was going to
be a mathematical logician. I suppose, on the whole, it would have been
simpler...
-- 
      Eric S. Raymond = eric@snark.uu.net    (mad mastermind of TMN-Netnews)