The big issue with this pseudo code is that you are busy-waiting on that $ALIVE variable: always a bad idea.
While $ALIVE; do sleep(n); done would be better, but not much.
If this was done, you would need a separate function that waited on the jobs more efficiently than that busy waiting. A busy wait (Hmm, I hope that is the name for a hard loop like this(It is: Thanks wikipedia)) is the definition of inefficient programming.
I also am not sure if shell variables could be used in this way: the called program would have it's own environment, so $ALIVE in the calling process would remain untouched.
My syntax would look more like this.
Code:
jobid == fork $remote_program
exec $local_program
fork-wait $jobid
This (or something similar) could probably be done using current shell commands: & of a process, and check/wait on it's job number. (Maybe you'd have to do that with a busywait, though.