Submit: Your code will be accessible for grading and TA-Bot runs if it is placed in a properly named project_6 branch.
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.
First, copy your project_5 branch into a new project_6 branch:
git switch project_5
git branch project_6
git switch project_6
Now this is the important one folks:
git push -u origin project_6
Then, on your project_6 branch (you should already be here), untar the new project files on top of it:
tar xvzf ~brylow/os/Projects/xinu-hw6.tgz
Commit and push your changes to GitHub:
git add .
git commit -m "<message>"
git push
You will use three round-robin priority queues (one each for "PRIORITY_LOW", "PRIORITY_MEDIUM", and "PRIORITY_HIGH") to add priority scheduling to your operating system.
This priority scheduler can be implemented in four easy steps:
dispatch() function in dispatch.c 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.
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'.
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'.
dispatch()
function in the dispatch.c file to handle interrupts.
if((long)cause > 0) {
cause = cause << 1;
cause = cause >> 1;
// ... Your dispatch code here ...
} else {
cause = cause << 1;
cause = cause >> 1;
uint irq_num;
volatile uint *int_sclaim = (volatile uint *)(PLIC_BASE + PLIC_SCLAIM_REG);
irq_num = *int_sclaim;
if(cause == I_SUPERVISOR_EXTERNAL) {
interrupt_handler_t handler = interruptVector[irq_num];
*int_sclaim = irq_num;
if (handler)
{
(*handler) ();
} else {
kprintf("ERROR: No handler registered for interrupt %u\r\n",
irq_num);
while (1)
;
}
}
}
[Revised 2026 Feb 26 00:32 DWB]