Slide 1Lecture 26Multilevel Queue SchedulingMultilevel feedback queueExample of a multilevel feedback queue examMultilevel Feedback QueuesUnix schedulerComparison of scheduling algorithmsSlide 9Slide 10Terminology for scheduling algorithmsOne-machine environmentOne-machine environment (cont’d)Priority rules for one machine environmentReal-time schedulersEarliest deadline first (EDF)Schedulability test for Earliest Deadline FirstCOT 4600 Operating Systems Fall 2009Dan C. MarinescuOffice: HEC 439 BOffice hours: Tu-Th 3:00-4:00 PM222222Lecture 26ScheduleTuesday November 24 - Project phase 4 and HW 6 are due Tuesday December 1st -Research projects instead of final exam presentationThursday December 3rd - Class reviewLast time: SchedulingToday: (Chapter 7) - available online from the publisher of the textbookMore on SchedulingNetwork propertiesLayersLink layerNext Time: Network layerTransport layerMultilevel Queue SchedulingMultilevel feedback queueA process can move between the various queues; aging can be implemented this wayMultilevel-feedback-queue scheduler characterized by:number of queuesscheduling algorithms for each queuestrategy when to upgrade/demote a processstrategy to decide the queue a process will enter when it needs serviceExample of a multilevel feedback queue examThree queues: Q0 – RR with time quantum 8 millisecondsQ1 – RR time quantum 16 millisecondsQ2 – FCFSSchedulingA new job enters queue Q0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q1.At Q1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q2.Multilevel Feedback QueuesUnix schedulerThe higher the number quantifying the priority the lower the actual process priority. Priority = (recent CPU usage)/2 + baseRecent CPU usage how often the process has used the CPU since the last time priorities were calculated.Does this strategy raises or lowers the priority of a CPU-bound processes?Example: base = 60Recent CPU usage: P1 =40, P2 =18, P3 = 10Comparison of scheduling algorithmsRound Robin FCFS MFQMulti-LevelFeedback QueueSFJShortest Job FirstSRJNShortest Remaining Job NextThroughputResponsetimeMay be low is quantum is too smallShortest average responsetime if quantum chosen correctlyNot emphasizedMay be poor May be low is quantum is too smallGood for I/O bound but poor for CPU-bound processesHighGood for short processesBut maybe poor for longer processesHighGood for short processesBut maybe poor for longer processesRound RobinFCFS MFQMulti-LevelFeedback QueueSFJShortest Job FirstSRJNShortest Remaining Job NextIO-boundInfinite postponementNo distinctionbetweenCPU-bound andIO-boundDoes not occurNo distinctionbetweenCPU-bound andIO-boundDoes not occurGets a high priority if CPU-bound processes are presentMay occur for CPU bound processesNo distinctionbetweenCPU-bound andIO-boundMay occur for processes with long estimated running timesNo distinctionbetweenCPU-bound andIO-boundMay occur for processes with long estimated running timesRound RobinFCFS MFQMulti-LevelFeedback QueueSFJShortest Job FirstSRJNShortest Remaining Job NextOverheadCPU-boundLowNo distinctionbetweenCPU-bound andIO-boundThe lowestNo distinctionbetweenCPU-bound andIO-boundCan be high Complex data structures and processing routines Gets a low priority if IO-bound processes are presentCan be high Routine to find to find the shortest job for each rescheduleNo distinctionbetweenCPU-bound andIO-boundCan be high Routine to find to find the minimum remaining time for each rescheduleNo distinctionbetweenCPU-bound andIO-boundTerminology for scheduling algorithmsA scheduling problems is defined by : The machine environment A set of side constrains and characteristics The optimality criterionMachine environments:1 One-machine. P Parallel identical machinesQ Parallel machines of different speedsR Parallel unrelated machinesO Open shop. m specialized machines; a job requires a number of operations each demanding processing by a specific machineF Floor shop)()()(),,(One-machine environmentn jobs 1,2,….n. pj amount of time required by job j.rj the release time of job j, the time when job j is available for processing. wj the weight of job j.dj due time of job j; time job j should be completed.A schedule S specifies for each job j which pj units of time are used to process the job.CSj the completion time of job j under schedule S.The makespan of S is: CSmax = max CSj The average completion time isnjSjCn11One-machine environment (cont’d)Average weighted completion time:Optimality criteria minimize: the makespan CSmaxthe average completion time :The average weighted completion time: the lateness of job j maximum lateness of any job under schedule S. Another optimality criteria, minimize maximum lateness.njSjjCw1njSjC1njSjjCw1SjnjLL1maxmaxjSjjdCL Priority rules for one machine environmentTheorem: scheduling jobs according to SPT – shortest processing time is optimal for Theorem: scheduling jobs in non-decreasing order of is optimal for jjCw||1jjpwjC||1Real-time schedulersSoft versus hard real-time systemsA control system of a nuclear power plant hard deadlinesA music system soft deadlinesTime to extinction time until it makes sense to begin the actionEarliest deadline first (EDF)Dynamic scheduling algorithm for real-time OS. When a scheduling event occurs (task finishes, new task released, etc.) the priority queue will be searched for the process closest to its deadline. This process will then be scheduled for execution next.EDF is an optimal scheduling preemptive algorithm for uniprocessors, in the following sense: if a collection of independent jobs, each characterized by an arrival time, an execution requirement, and a deadline, can be scheduled (by any algorithm) such that all the jobs complete by their deadlines, the EDF will schedule this collection of jobs such that they all complete by their deadlines.16Schedulability test for Earliest Deadline First1711njjpdjUProcessExecution
View Full Document