Why 10ms ? This is based on the timer interrupt frequency setup in xv6 and you may find the code for it in For example, if there are three processes A, B and C, then the pattern under the vanilla round-robin scheduler will be A B C A B C …, where each letter represents a process scheduled within a timer tick, which is essentially ~10ms, and you may assume that this timer tick is equivalent to a single iteration of the for loop in the scheduler() code. The vanilla xv6 does no fancy things about the scheduler it simply schedules processes for each iteration in a round-robin fashion. If there are multiple runnable processes, it will select one according to some policy. It¡¯s essentially looping forever and for each iteration, it looks for a runnable process across the ptable. Most of the code for the scheduler is quite localized and can be found in kernel/proc.c, where you should first look at the routine scheduler(). Pages.cs./~shivaram/cs537-sp20/p2b.htmlĭiscussion video from this year ( +Psychology105++5.30.24PM/0_90wjyp9d) and from last year () Void boostproc(void) which boosts the process one level in the MLFQ scheduler. Int getprocinfo(struct pstat *) to extract process state to test the scheduler. The scheduling method in each of these queues will be round-robin. The time-slices for higher priorities will be shorter than lower priorities. When a process uses up its time-slice (counted as a number of ticks), it should be downgraded to the next (lower) priority level. The top queue (numbered 3 ) has the highest priority and the bottom queue (numbered 0 ) has the lowest priority. Overview of MLFQ scheduler in this assignment: In this project, you¡¯ll be implementing a simplified multi-level feedback queue (MLFQ) scheduler in xv6. To create system calls to extract process states and test the scheduler To implement a basic MLFQ scheduler and Round-Robin scheduling method. To understand code for performing context-switches in the xv6 kernel. There will soon be a quiz on Canvas that will check if you have read the spec closely. This project is to be done on the lab machines (), so you can learn more about programming in C on a typical UNIX-based platform (Linux). Please help us all have a good semester by not doing this. Read this () for more info on what is OK and what is not. Copying code (from others) is considered cheating. Questions: We will be using Piazza for all questions.Ĭollaboration: The assignment has to be done by yourself. 5 CS 537 Introduction to Operating SystemsĬS 537 Spring 2020, Project 2b: xv6 Scheduler If ti me-slice too small - more contex t switching for /to new p roce sses. Tim e-slic e setting may affect performanc e: If t im e-slice too large - degenerates to FCFS (first- com e-fir st-serve) and can result in the convoy effect where one process keeps the CPU until it releases less context switching. If a user process exceeds the time-slice it is preempted and put back on the Ready Queue. Preemption (when process switches state) is added between processes. Time Slice (or time quantum) is set at 2 seconds for each user process before the next user process get control of the CPU. Jim Heffernan Assignm ent 4 03/02/98 10:24:10 AM Problem of the We ek # 2 Algorithm (pseudocode): (Round Robin (RR) Scheduling) let (time) quantum be 2 (sec.) -time slice if cou ntQu eue(C PUQU EUE) e qual s 1 THE N - is a proce ss (tra n) runn ing ? if headqueue PCB_run equals 0 THEN - proc ess has compl eted take process off CPU if countQueue(READYQ UEUE) greater than 0 THEN issue_process onto CPU decrement time quantum counter el se - proc ess has not completed if headqueu e time quantum equals 0 THEN - time's up! if countQueue(READ YQUEUE) greater than 0 THEN remove process from CPUQ and insert into READYQUEUE reset time quantum counter issue next available process onto CPUQ decrement time quantum counter els e -no processes (trans) in rea dy que ue reset time quantum counter run for a tick decrement time quantum counter el se -qu antu m has not expir ed run for a tick decrement time quantum counter els e -C PU is idle if (countQueue(READY QUEUE) greater than 0 THEN issue process onto CPU decrement time quantum counter end_if end_if end_if end_if end_if end Assumptions: - 1.
0 Comments
Leave a Reply. |