Jim's
Tutorials

Spring 2010
course
navigation

process scheduling stuff

Notes on modification of the Minix kernel to fit the problem in chapter 2.
The original problem was to modify the scheduler code of Minix so that it kept track of time used by each process, then to modify the scheduler so that the process that had used the least time got to run. The code here keeps track of the used time, but only outputs it through a debug routine; attempts to output to a file crashed the system.
I'll put the edited lines of code here with line numbers, but the line numbers are only valid for version 3.1.1.
in proc.h, code needs to be added to store the runtime in the process data structure. At line 56, I put: int p_runtime; In proc.c, you have to keep track of the runtime in that new variable. At line 580: rp->p_runtime = rp->p_runtime + rp->p_quantum_size; Finally, in dmp_kernel.c, the routine that prints some process information has to be modified to print the new variable. Modify the printf at line 478: printf(" %-8.8s %d %02u/%02u %02d/%02u, %6lu%6lu %6uK%6uK%6uK %s", then insert a new line 480: rp->p_runtime, If desired, one could also modify 466 so that it lists the new variable in the header.
With all of that added, running "make world" from /usr/src should recompile it successfully, and pressing f1 should display the new information.