[net.micro.amiga] An Idea for an ambitious programmer

jacs4440@oswego.UUCP (Dan/Mark) (10/07/86)

[ eat away ... ]

 I don't have time to work out the numerous details of this, but it would
be really nice if someone out in netland, would try to write the equivalent
of UN*X's fork() syscall. Execute() is nice and all, but sometimes, fork()
would be so much nicer. Maybe someone at C-A could help out a little here.

ps. while you're at it, exec() would also be nice. 

                                                  - mark

cc1@locus.ucla.edu (Michael Gersten) (10/08/86)

Neither fork() nor exec() can be written for the amiga. Why?
 
Fork(): What addresses are you going to fork? There is no way to find all
of your memory; the best you can get is program and stack. But, all those
non-relative addresses in your code will be wrong. All those pointers
on the stack will point to shared data.

Exec(): At some point, you have to unload yourself and load the next program.
If memory is a problem, you have to unload yourself first, and the loadseg()
might overwrite the exec() routine. If that isn't the problem, then
you can
forbid()
loadseg()
unloadseg()
?????
 
At this point, you Can Not just call the other routine, as permit() will never
be called. Start a new process? That has a few problems--you are no longer the
same process nor the same task (message port is different), but it solves the
killer permit problem. But it won't be identical to exec(), some of the
process data might not get copied over correctly (not sure just what AddProc()
does copy).
 
Exec() really should be an AmigaDos call. And yes, I did suggest this to
Amiga a while ago.
		Michael Gersten
      Views expressed here may not be those of the Computer Club, UCLA, or
  anyone in their left OR right mind.  And that's the name o' that tune.

higgin@cbmvax.cbm.UUCP (Paul Higginbottom) (10/09/86)

In article <762@oswego.UUCP> jacs4440@oswego.UUCP (Mark Reichert) writes:
> I don't have time to work out the numerous details of this, but it would
>be really nice if someone out in netland, would try to write the equivalent
>of UN*X's fork() syscall. Execute() is nice and all, but sometimes, fork()
>would be so much nicer. Maybe someone at C-A could help out a little here.
>
>ps. while you're at it, exec() would also be nice. 
>
>                                                  - mark

The exec() and fexec() family of functions are supplied as part of Manx's
Aztec C library.  They are "trivial" compared to a fork() function.

The big problem would be trying to get the new "clone" of the program to
start executing in the same "state" as the original.  This would mean
(as far as I can tell) copying stacks (and adjusting addresses, ugh),
initializing all the task stuff appropriately to the original... doesn't
sound easy.  To get the same program running from the BEGINING isn't hard
by using fexecv().

	Paul.

Disclaimer: I do not work for Commodore, and my opinions are my own.