Chapter 7 Scheduling Chien-Chung Shen CIS/UD

Slides:



Advertisements
Similar presentations
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Advertisements

CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
CPU Scheduling CPU Scheduler Performance metrics for CPU scheduling
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Operating Systems Chapter 6
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
CPU Scheduling Algorithms
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
02/06/2008CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
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.
More Scheduling cs550 Operating Systems David Monismith.
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
Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
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.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
CPU Scheduling Basic Concepts. Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
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.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
CPU Scheduling Algorithms CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
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.
CPU Scheduling Andy Wang Operating Systems COP 4610 / CGS 5765.
Scheduling Policies.
CPU SCHEDULING.
Chapter 5a: CPU Scheduling
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
Chapter 6: CPU Scheduling
Andy Wang Operating Systems COP 4610 / CGS 5765
Operating System Concepts
CPU SCHEDULING.
Process Scheduling Decide which process should run and for how long
CSE 451: Operating Systems Winter 2003 Lecture 6 Scheduling
Processor Scheduling Hank Levy 1.
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
CPU Scheduling: Basic Concepts
CSE 451: Operating Systems Winter 2001 Lecture 6 Scheduling
Presentation transcript:

Chapter 7 Scheduling Chien-Chung Shen CIS/UD

Scheduling Low-level mechanisms - context switching High-level policies – scheduling policies Appears in many fields – e.g., assembly lines for efficiency How to develop a framework for studying scheduling policy? 1.assumptions of workload 2.metrics of performance 3.approaches

1. Workload Assumptions Workload – {processes} running in the system –critical to building policies - the more you know, the more fine-tuned your policy can be –unrealistic, initially, but will be relaxed later 1.Each job runs for the same amount of time 2.All jobs arrive at the same time 3.Once started, each job runs to completion 4.All jobs only use CPU (i.e., they perform no I/O) 5.The run-time of each job is known

2. Scheduling Metrics To compare different scheduling policies, we need metrics to quantify behavior Turnaround time - the time at which the job completes minus the time at which the job arrived in the system –a performance metric Fairness metric –Jain’s Fairness Index Performance vs. fairness tradeoff

First In First Out (FIFO) First come, first served (FCFS) Each job runs 10 sec. Average turnaround time = ? = ( )/3 = Each job runs for the same amount of time 2. All jobs arrive at the same time 3. Once started, each job runs to completion 4. All jobs only use CPU (i.e., they perform no I/O) 5. The run-time of each job is known

First In First Out (FIFO) What kind of workload could you construct to make FIFO perform poorly? Relax assumption #1: jobs could have different run times) Average turnaround time = ? = ( )/3 = 110 Convoy effect (supermarket checkout) Can you improve it? 1. Each job runs for the same amount of time 2. All jobs arrive at the same time 3. Once started, each job runs to completion 4. All jobs only use CPU (i.e., they perform no I/O) 5. The run-time of each job is known

Shortest Job First (SJF) Average turnaround time = ? = ( )/3 = 50 Assuming all jobs arrive at the same time, SJF is optimal Relax assumption #2: arrival time average turnaround time = (100+(110-10)+(120-10))/3 = How can we do better? 1. Each job runs for the same amount of time 2. All jobs arrive at the same time 3. Once started, each job runs to completion 4. All jobs only use CPU (i.e., they perform no I/O) 5. The run-time of each job is known

Shortest Time-to-Completion First SJF with A arrives at 0, and B, C at 10 How would you do better? Relax assumption #3  Preemption  STCF or Preemptive SJF (also optimal with assumption that jobs arrive at any time) 1. Each job runs for the same amount of time 2. All jobs arrive at the same time 3. Once started, each job runs to completion 4. All jobs only use CPU (i.e., they perform no I/O) 5. The run-time of each job is known

New Metric With known job lengths, CPU-only jobs, metric of turnaround time, STCF is great for batch system Time sharing system with interactive applications - need new metric Response time = time from when the job arrives in a system to the first time it is scheduled

Response Time Response time = ( )/3 = 3.33 Is STCF (or SJF) good for interactive applications?

Round Robin Instead of running jobs to completion, RR runs a job for a (small) time slice (scheduling quantum) and switches to the next job in the ready queue; repeatedly does so until jobs are finished Time slicing – length of time slice = multiple of timer- interrupt period –SJF response time = 5 –RR response time = 1 Length of time slide is critical

Round Robin Amortization (in general) –used in systems when there is a fixed cost to some operation –By incurring that cost less often, the total cost to the system is reduced Length of time slice on response time ??? –The shorter the time slice, the shorter (better) the response –Too short, cost of context switching (overhead) dominates –Length of time slice is a tradeoff - long enough to amortize the cost of context switching without making it so long that the system is no longer responsive Any policy (such as RR) that is fair (evenly divides CPU among active processes on a small time scale), will perform poorly on metrics such as turnaround time

Incorporating I/O Process is blocked waiting for I/O completion When I/O completes, an interrupt is raised, and OS runs and moves the process that issued the I/O from blocked state back to the ready state Poor use of CPU Overlap CPU & I/O –higher CPU utilization Interactive jobs get run frequently; while they are performing I/O, other CPU-intensive jobs run Job B has no I/O