9fans archive / 1999 / 07 / 9 / prev next From: steve.kilbane@ind... steve.kilbane@ind... Subject: [9fans] spawn() vs fork() Date: Mon, 5 Jul 1999 08:57:49 +0100 On 03/07/99 16:22:21 Digby Tarvin wrote: > That compromise meant that a fork() style of process creation > was not possible (all pointers in the child's data segment would > be pointing into the parents memory), so it uses a spawn() style > of process creation. It's not impossible: the Atari ST port of Minix managed fork() on M68000. I believe the solution was to swap data and stack segments during a context switch. This meant that anything that forked a child and then talked to it for a while would run like treacle. Since most processes followed a fork() with an exec(), it wasn't so much of a problem. All very reminiscent of vfork(). Implementation requirements aside, as Jean says, fork gives you an elegant way of setting up I/O redirection. It also gives you an elegant way of determining start-up context as a whole for the new process., including internal state. steve