I have have had a go at implementing vfork() for ELKS as I thought it would
gain us quite a lot in lower overhead for running processes. I have managed
to get a version of vfork() working as follows.

The parent process's data segment is not copied, just re-alloced, and
rather than returning to the parrent process, fork sleeps on the parents
child_wait wait queue.

The child then runs, and when it execs, it wakes up its parents child_wait
wait queue, allowing it to carry on as normal. If the child fails to exec,
it just exits as normal, which again wakes up the parent.

All this seems to work just fine, but to make sure the parents stack
does not get corrupted by the child before it execs, I make a copy
of the bottom 100 bytes on the stack, below the stack, for the child to
use.

I am not quite sure this is the best way to do it. Any comments or
suggestions?

Al

Reply via email to