Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!voder!pyramid!ctnews!risky!pase70!scottl From: scottl@convergent.com (Scott Lurndal) Newsgroups: comp.unix.wizards Subject: Re: UNIX v7 calling sched() Message-ID: <4039@risky.Convergent.COM> Date: 15 Apr 91 19:32:08 GMT References: <1991Apr12.172939.6348@ncsu.edu> <7101@segue.segue.com> Sender: root@risky.Convergent.COM Reply-To: scottl@convergent.com (Scott Lurndal) Organization: Unisys Network Computing Group Lines: 38 In article <7101@segue.segue.com>, jim@segue.segue.com (Jim Balter) writes: |> In article <1991Apr12.172939.6348@ncsu.edu> miler@osl.csc.ncsu.edu (George Miler) writes: |> > main () |> > { |> > ...... |> > if (newproc()) <==== true, create /etc/init process |> > { |> > copy (/etc/init) |> > return; <==== exit main, starts copied process |> > } |> > sched (); <==== never reached if did /etc/init |> > } |> |> Do you understand how |> |> main () |> { |> if (fork() == 0) |> { |> childstuff(); |> return; |> } |> parentstuff(); |> } |> |> works? newproc() is just the kernel level equivalent of fork. |> It returns twice, into two different processes, with a 0 return to the parent |> and a non-zero return to the child (fork is the other way around). |> [examples deleted] I seem to recall a caveat in Lyons commentary to the effect of "you're not expected to understand this." :-) scott.