Project 2b: xv6 SchedulerObjectivesThere are three objectives to this assignment:
OverviewIn this project, you'll be putting a new scheduler into xv6. It is called a stride scheduler , and is described in this chapter of the online book. The basic idea is simple: assign each running process a slice of the processor based in proportion to the number of tickets it has; the more tickets a process has, the more it runs. DetailsYou'll need a couple of new system calls to implement this scheduler. The first is int settickets(int num) , which sets the number of tickets of the calling process. By default, each process should get one ticket; calling this routine makes it such that a process can raise the number of tickets it receives, and thus receive a higher proportion of CPU cycles. This routine should return 0 if successful, and -1 otherwise (if, for example, the user passes in a number less than one). The second is int getusage(void) . This routine returns the number of time slices that the process has run. By calling it repeatedly, one could determine how much CPU time a process is getting. TipsMost of the code for the scheduler is quite localized and can be found in proc.c ; the associated header file, proc.h is also quite useful to examine. To change the scheduler, not much needs to be done; study its control flow and then try some small changes. The CodeThe source code for xv6 (and associated README) can be found in ~cs537-1/ta/xv6/ . Everything you need to build and run and even debug the kernel is in there. You may also find the following readings about xv6 useful, written by the same team that ported xv6 to x86: xv6 book Particularly useful for this project: Chapters 5. What To Turn InBeyond the usual code, you'll have to make a graph for this assignment. The graph should show the number of time slices a set of two processes receives over time, where one process has twice the number of tickets as the other. The graph is likely to be pretty boring, but should clearly show that your stride scheduler works as desired. |