UNIX v7 calling sched()

Scott Lurndal scottl at convergent.com
Tue Apr 16 05:32:08 AEST 1991


In article <7101 at segue.segue.com>, jim at segue.segue.com (Jim Balter) writes:
|> In article <1991Apr12.172939.6348 at ncsu.edu> miler at 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.



More information about the Comp.unix.wizards mailing list