Newsgroups: comp.unix.wizards Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!ghost.unimi.it!marco From: marco@ghost.unimi.it (Marco Negri) Subject: Re: UNIX v7 calling sched() Message-ID: <1991Apr12.205055.25220@ghost.unimi.it> Organization: Computer Science Dep. - Milan University References: <1991Apr12.172939.6348@ncsu.edu> Date: Fri, 12 Apr 1991 20:50:55 GMT Lines: 40 miler@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@ghost.unimi.it