logo

Extensions to the Multitasking Kernel

2 Pages852 Words280 Views
   

Added on  2019-09-18

About This Document

This assignment from Desklib focuses on extending the multitasking kernel to include the preemptive scheduler. The assignment requires setting and running the system timer, adding a CPU quantum to each process, keeping counts of CPU usage and output characters, and adding an int parameter to the scheduler function. The testing procedures involve confirming preemption during idle loops and testing CPU-intensive programs.

Extensions to the Multitasking Kernel

   Added on 2019-09-18

ShareRelated Documents
University of Massachusetts - BostonDr. Ronald CheungCS 444: Intro to Operating SystemsSpring 2019Homework AssignmentHW5: Extensions to the Multitasking Kernel Assigned:30 April 2019Due: 16 May 20191.Introduction The objective of this assignment is to extend the multitasking kernel obtained in hw3 to include the preemptive scheduler. Copy the files to your cs444/hw5 dir. Provide a README with guide to your sources. 2.Preemptive schedulerConvert the scheduler to be preemptive, and let process 0 run an idle loop at normal process level, preempted as necessary for the user processes. Of course this requires a clock ticking. 1) You will need to set and run the system timer, the "PIT". An example of how to do this is in $pcex/timetest.c. The timer(or "clock") in timetest.c will take up to approximately 55 milliseconds to run down and cause an interrupt. Change it to interrupt every 10 ms, like Linux. When you first fold this in, it will print a "." for every tick--leave that in for a while, to make sure it's ticking away, but take out the dots before the final testing.2) Add a CPU quantum to each process. Use a quantum between 4x10 to 10x10 ms. Decrement it in the tick handler and call schedule when it's gone. You should confirm that when there are two cpu boundprocesses, they alternate in execution. The preemptions of user processes are recorded in the debug_log and printed out at the end of the run along with the marks for input, output, and process-switch from zombie.3) Keep counts of how much cpu each uprog uses and how many characters each outputs. To do this add appropriate fields to the proc structure. At each tick, increment the cpu field of the running process.Also, each time there is a successful enqueue, increment the output character count. Print the counts when the whole program exits (that is, when you print the exit values).4) As a debugging tool add an int parameter to the scheduler function. Each call site to the scheduler should use a different integer for this parameter. (e.g. if there are 3 call sites, use 0, 1 and 2). Createan int array in the kernel data area whose size is the number of integers used. The idea is that when the scheduler is called from call site 0, you will increment the 0th element of the array by 1, when called from call site 1, increment the 1st element, etc. Print output the accumulated values at the finish. This will allow you to confirm that the scheduler is being called from the clock interrupt handler.There may be new race conditions in the kernel due to preemption in the kernel. For example, "number_of_zombie++" in sysexit needs protection unless we can prove it is implemented with just one instruction. Otherwise, between the two, there could be a preemption causing another process to run andexit, reading the old count. They both end up writing the same count, losing one increment. This is called the lost update problem. Most of the ++'s are acting on local variables-- these are process-private and thus immune from such shared access.1
Extensions to the Multitasking Kernel_1

End of preview

Want to access all the pages? Upload your documents or become a member.