Lec07 - Computer Science Lecture 7, page 1 Computer Science...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Computer Science Lecture 7, page 1 Computer Science CS377: Operating Systems Last Class: CPU Scheduling Scheduling Algorithms: FCFS Round Robin SJF Multilevel Feedback Queues Lottery Scheduling Review questions: How does each work? Advantages? Disadvantages? Computer Science Lecture 7, page 2 Computer Science CS377: Operating Systems Adjusting Priorities in MLFQ Job starts in highest priority queue. If job's time slices expires, drop its priority one level. If job's time slices does not expire (the context switch comes from an I/O request instead), then increase its priority one level, up to the top priority level. ! CPU bound jobs drop like a rock in priority and I/O bound jobs stay at a high priority. Computer Science Lecture 7, page 3 Computer Science CS377: Operating Systems Multilevel Feedback Queues:Example 1 3 jobs, of length 30, 20, and 10 seconds each, initial time slice 1 second, context switch time of 0 seconds, all CPU bound (no I/O), 3 queues Job Length Completion Time Wait Time RR MLFQ RR MLFQ 1 30 2 20 3 10 Average Queue Time Slice Job 1 1 2 2 3 4 Computer Science Lecture 7, page 4 Computer Science CS377: Operating Systems Multilevel Feedback Queues:Example 1 5 jobs, of length 30, 20, and 10 seconds each, initial time slice 1 second, context switch time of 0 seconds, all CPU bound (no I/O), 3 queues Job Length Completion Time Wait Time RR MLFQ RR MLFQ 1 30 60 60 30 30 2 20 50 53 30 33 3 10 30 32 20 22 Average 46 2/3 48 1/3 26 2/3 28 1/3 Queue Time Slice Job 1 1 1 1 1 , 2 2 1 , 3 3 1 2 2 1 5 3 , 2 7 3 , 3 9 3 3 4 1 13 7 , 2 17 7 , 3 21 7 1 25 11 , 2 29 11 , 3 32 10 ... Computer Science Lecture 7, page 5 Computer Science CS377: Operating Systems Multilevel Feedback Queues:Example 2 3 jobs, of length 30, 20, and 10 seconds, the 10 sec job has 1 sec of I/0 every other sec, initial time slice 2 sec, context switch time of 0 sec, 2 queues. Job Length Completion Time Wait Time RR MLFQ RR MLFQ 1 30 2 20 3 10 Average Queue Time Slice Job 1 1 2 2 Computer Science Lecture 7, page 6 Computer Science CS377: Operating Systems Multilevel Feedback Queues:Example 2 3 jobs, of length 30, 20, and 10 seconds, the 10 sec job has 1 sec of I/0 every other sec, initial time slice 1 sec, context switch time of 0 sec, 2 queues. Job Length Completion Time Wait Time RR MLFQ RR MLFQ 1 30 60 60 30 30 2 20 50 50 30 30 3 10 30 18 20 8 Average 46 2/3 45 26 2/3 25 1/3 Computer Science Lecture 7, page 7 Computer Science CS377: Operating Systems Improving Fairness Since SJF is optimal, but unfair, any increase in fairness by giving long jobs a fraction of the CPU when shorter jobs are available will degrade average waiting time....
View Full Document

Page1 / 13

Lec07 - Computer Science Lecture 7, page 1 Computer Science...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online