Chapter 8 Multi-Level Feedback Queue Chien-Chung Shen CIS, UD

Slides:



Advertisements
Similar presentations
CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
Advertisements

CPU Scheduling CPU Scheduler Performance metrics for CPU scheduling
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 19 Scheduling IV.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
OS Spring ’ 04 Scheduling Operating Systems Spring 2004.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
1 Scheduling Algorithms FCFS First-Come, First-Served Round-robin SJF Multilevel Feedback Queues.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Chapter 6 CPU SCHEDULING.
Number of processes OS switches context from A to B main use fork, and the child process call execvp() Can compiler do something bad by adding privileged.
CS252: Systems Programming Ninghui Li Based on Slides by Prof. Gustavo Rodriguez-Rivera and Chapters 7,8 of OSTEP Topic 20: Processes Scheduling.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
Chapter 7 Scheduling Chien-Chung Shen CIS, UD
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
E X C E E D I N G E X P E C T A T I O N S Time Mgt Linux System Administration Dr. Hoganson Kennesaw State University OS Time Management Time management.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
Process A program in execution. But, What does it mean to be “in execution”?
Practice four Chapter six. 1. A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
First In First Out SJF is a scheduling policy that selects a waiting process with the smallest execution time to execute next. Shortest Job First Shortest.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Chapter 7 Scheduling Chien-Chung Shen CIS/UD
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU Scheduling Andy Wang Operating Systems COP 4610 / CGS 5765.
Scheduling Policies.
CPU SCHEDULING.
Operating Systems CS 550 Spring 2017 Kenneth Chiu
Kernel Stack Desirable for security: e.g., illegal parameters might be supplied.
Chapter 5a: CPU Scheduling
Chapter 8 Multi-Level Feedback Queue
Scheduling: The Multi-Level Feedback Queue
Uniprocessor Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Module 5: CPU Scheduling
Andy Wang Operating Systems COP 4610 / CGS 5765
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Process Scheduling Decide which process should run and for how long
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Chien-Chung Shen CIS/UD
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Scheduling: The Multi-Level Feedback Queue
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

Chapter 8 Multi-Level Feedback Queue Chien-Chung Shen CIS, UD

Problems and Solution Problems to be addressed –optimize turnaround time (by running shorter jobs first) –minimize response time for interactive users Do we know anything (running time) about the jobs? –How to schedule without perfect knowledge? –Can the scheduler learn? How? Learn from history –learn from the past to predict the future

MLFQ Multiple queues with different priority levels MLFQ varies the priority of a job based on its observed behavior –job repeatedly relinquishes CPU while waiting for input from keyboard, MLFQ will keep its priority high –job uses the CPU intensively for long periods of time, MLFQ will reduce its priority –use history of job to predict its future behavior Rule 1: If Priority(A) > Priority(B), A runs (B doesn’t) Rule 2: If Priority(A) = Priority(B), A & B run in RR

MLFQ Priority changes over time How? Workload - a mix of interactive jobs that are short- running (and may frequently relinquish CPU), and some longer-running “CPU-bound” jobs that need a lot of CPU time but where response time isn’t important Rule 3: When a job enters the system, it is placed at the highest priority (the topmost queue) Rule 4a: If a job uses up an entire time slice while running, its priority is reduced (i.e., it moves down one queue) Rule 4b: If a job gives up CPU before the time slice is up, it stays at the same priority level

Examples One long-running job Along came a short job –because scheduler doesn’t know whether a job is short or long- running, it first assumes it is a short job –approximate SJF? If it actually is a short job, it will run quickly and complete; if it is not a short job, it will slowly move down the queues, and thus soon prove itself to be a long-running In this manner, MLFQ approximates SJF

How about I/O? Rule 4b: If a job gives up CPU before the time slice is up, it stays at the same priority level Any problem??? –starvation with many interactive jobs –game (trick) the scheduler to remain at the same queue (e.g., right before time slice is over, issue an I/O) –changing behavior over time

Priority is the Key How to guarantee CPU- bound jobs make progress ??? Priority boost Rule 5: After some time period S, move all the jobs in the system to the topmost queue –no starvation –accommodate changing behavior Priority boost every 50 msec

Better Accounting How to prevent gaming the scheduler ? –a job retains its priority by relinquishing CPU (right) before the time slice expires –perform better accounting of CPU time at each level of MLFQ – scheduler keeps track of how much of a time slice a job used at a given level; once a job has used its allotment, it is demoted to the next priority queue

Better Accounting Rule 4a: If a job uses up an entire time slice while running, its priority is reduced (i.e., it moves down one queue) Rule 4b: If a job gives up CPU before the time slice is up, it stays at the same priority level  Rule 4 (anti-gaming): Once a job uses up its time allotment at a given level (regardless of how many times it has given up the CPU), its priority is reduced

Tuning MLFQ How to parameterize MLFQ ? –how many queues –how big should time slice be per queue –how often should priority be boosted No easy answers and need experience with workloads –varying time-slice length across different queues

Summary Rule 1: If Priority(A) > Priority(B), A runs (B doesn’t) Rule 2: If Priority(A) = Priority(B), A & B run in RR Rule 3: When a job enters the system, it is placed at the highest priority (the topmost queue) Rule 4: Once a job uses up its time allotment at a given level (regardless of how many times it has given up the CPU), its priority is reduced (i.e., it moves down one queue) Rule 5: After some time period S, move all the jobs in the system to the topmost queue instead of demanding a priori knowledge of a job, it instead observes the execution of a job and prioritizes it accordingly it manages to achieve the best of both worlds: it can deliver excellent overall performance (similar to SJF/STCF) for interactive jobs, and is fair and makes progress for long-running CPU-intensive workloads