Project #6: Multicore Priority Scheduling and Preemption

Submit: Turn in your entire xinu-hw6 directory source files using the turnin command on morbius.mscsnet.mu.edu or one of the other Systems Lab machines. Please run "make clean" in the compile/ subdirectory just before submission to reduce unnecessary space consumption.

Work should be completed in pairs. Be certain to include both names in the comment block at the top of all source code files, with a TA-BOT:MAILTO comment line including any addresses that should automatically receive results. It would be courteous to confirm with your partner when submitting the assignment.

Priority Scheduling

Preparation

First, make a copy of your Project 5 directory:
    cp -R xinu-hw5 xinu-hw6
Then, untar the new project files on top of it:
    tar xvzf ~brylow/os/Projects/xinu-hw6.tgz

Be certain to make clean before compiling for the first time.

Round-Robin Priority Scheduling

You will use three round-robin priority queues (one each for "low", "medium", and "high" priority) to add priority scheduling to your operating system. Three priority queues times four cores equals 12 total queues.

This priority scheduler can be implemented in three easy steps:

New test cases are in system/testcases.c, which should demonstrate priority-order execution once your new scheduler is operational. You will need to create others to fully test your implementation.

Starvation and Aging

One of the chief drawbacks to simple priority scheduling is that low priority processes may be starved by high priority processes. That is, they may never get to run at all. One remedy for this it to implement aging, a scheme in which the effective priority of a process increases the longer it sits in the ready list without running.

We've added a kernel configuration parameter "AGING" into include/kernel.h. Add code into resched.c so that when AGING is TRUE, available processes are moved, or "promoted", to a higher priority queue when certain time conditions are met (see TODOs in resched() and definitions in include/clock.h).

Construct a test case that demonstrates process starvation when AGING is FALSE, but demonstrates aging when AGING is set to TRUE. Put your aging test case in testcases.c, and make it run when the input is 'A'.

Preemption

The new files system/clk* will provide you with basic preemption, as discussed in class. Take time to familiarize yourself with the contents of these files, as you will be responsible for understanding how these components of the operating system work.

Activate preemption by changing the PREEMPT constant in include/kernel.h to TRUE. How can you test that preemption is working in your system? Create a test case that demonstrates preemptive scheduling. Put your preemption test case in testcases.c, and make it run when the input is 'P'.

Notes


[back]

[Revised 2020 Feb 10 14:54 DWB]