UNIX v7 calling sched()

Marco Negri marco at ghost.unimi.it
Sat Apr 13 06:50:55 AEST 1991


miler at osl.csc.ncsu.edu (George Miler) writes:
>     I am working on a project at NC State University involving porting
>UNIX Version 7 to a 68000 based machine.

Really that old old versione of unix I used 10 (!) years ago?
Or are you using another newer powered up version of Version 7?
I would like to know WHY you are using V7, what are the benefits for that?



>     In function main(), the internal inits are done and newproc is
>called to set up "/etc/init".  Once this is done, main() returns and
>the code in start.s does a return from interrupt to get things going.
>What I don't understand is how sched() gets going.  The sched() function
>is called if newproc() does not create the init process, followed by
>main() returning.  But, of course, we need /etc/init so that is done.

>  main ()
>  {
**************************	Here	Proc 0
>    ......
>    if (newproc())      <====   true, create /etc/init process
>    {
**************************	Here	Proc 1 	the famous init process
>      copy (/etc/init)
>      return;           <====   exit main, starts copied process
>    }
**************************	Here	Proc 0	Again
>    sched ();           <====   never reached if did /etc/init
>  }

I have checked my V7 sources and they are very similar to the code above.
The parent process (0) starts, using newproc() and copy sequence, the first
child process with PID 1.
The child process PID 1 is the around the world famous init. That forks every
other process in unix.
The parent process PID 0, continues its execution with sched() function.
This function implements the round-robin alghoritm for the process scheduling.

Ciao. Marco
-- 
Marco Negri				Phone  : +39-2-7575242
Universita` di Milano			Fax    : +39-2-76110556
Dip. Scienze dell'Informazione		Telex  : 335199 - MIDSII
Via Moretto da Brescia, 9		E-Mail : marco at ghost.unimi.it



More information about the Comp.unix.wizards mailing list