Unformatted text preview: Friday, April 10 Project #1 Project #2 Grading is nearly complete Scores will be posted soon Progress reports? Questions? Monday seminar in class Be prepared (questions for Ian) Today's topics Homework #1 More CPU scheduling Hybrid schedulers Multilevel queues Calculating burst times Homework #1 Solutions are posted Hybrid Schedulers Most operating systems use hybrids of the classical scheduling algorithms Linux Usually implemented with multilevel queues "constant time" scheduler "completely fair" scheduler More later Multilevel Queue Ready queue is partitioned into separate queues, e.g.: Each queue has its own scheduling algorithm, e.g., foreground RR background FCFS foreground (interactive) background (batch) Multilevel Queue Scheduling must consider all queues Examples: Fixed priority scheduling; (i.e., serve all from higher level before any from lower levels). A process can move between queues Time slice each queue gets a certain amount of CPU time which it can schedule among its processes Aging can be implemented this way. Possibility of starvation. Multilevel Queue Scheduling Multilevelfeedbackqueue scheduler defined by the following parameters:
number of queues scheduling algorithms for each queue methods used to determine next CPU burst time for a process when to upgrade a process priority when to demote a process priority etc. Multilevel Feedback Queue Determining length of next CPU Burst Can only estimate ... One method: exponential averaging t = actual length of the nth CPU burst First CPU burst is assigned (constant) Record actual CPU burst time Use previous CPU bursts to assign next. Exponential Averaging n +1 = t n + (1 - ) n . When =1 When =0 n+1 = t n Only the most recent actual CPU burst counts. n+1 = n Recent history does not count. Exponential Averaging n +1 = t n + (1 - ) n . Expand the formula: n+1 = tn + (1 - ) t n-1 + ... + (1 - ) j t n-j + ... + (1 - ) n+1 0 Since both and (1 ) are less than or equal to 1, older terms have less weight (as compared to more recent terms). Typical is 0.5 Example A longrunning process's most recent actual time in the CPU was 100 ms, although its calculated time slice was 140 ms. The exponential weighted average of older time slices is 180 ms. Recent history is weighted at 50%. i.e., tn1 = 140 tn = 100 = 0.5 n1 = 180 Using standard exponential averaging, what is the estimated length of this process's next time slice ( n+1)? Note: first find n , then use it to find n+1 Estimation errors If the estimated CPU burst length is smaller than the time actually needed by the process If the estimated CPU burst length is larger than the time actually needed by the process The process will surrender the CPU and go to the ready queue with a new estimated burst length. The process surrenders the CPU via normal means (termination, wait, I/O) The process's next burst time will be calculated based partly on it's actual time used. Questions? Reread Love Chapters 3,4 Homework #1 solutions are posted ...
View Full Document
- Spring '08
- Operating Systems, CPU time, Process states, CPU burst time, cpu burst