Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.

Slides:



Advertisements
Similar presentations
CPU SCHEDULING RONG ZHENG. OVERVIEW Why scheduling? Non-preemptive vs Preemptive policies FCFS, SJF, Round robin, multilevel queues with feedback, guaranteed.
Advertisements

Operating Systems ECE344 Ding Yuan Scheduling Lecture 10: Scheduling.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling (continued)CS-3013 C-term Scheduling (continued) CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Scheduling in Batch Systems
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
CPU Scheduling. Schedulers Process migrates among several queues –Device queue, job queue, ready queue Scheduler selects a process to run from these queues.
SchedulingCS-3013 A-term Scheduling The art and science of allocating the CPU and other resources to processes & threads CS-3013 Operating Systems.
1 Thursday, June 15, 2006 Confucius says: He who play in root, eventually kill tree.
SchedulingCS-3013 C-term Scheduling The art and science of allocating the CPU and other resources to processes (Slides include materials from Operating.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Chapter 5: CPU Scheduling
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
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.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
CS3530 OPERATING SYSTEMS Summer 2014 Processor Scheduling Chapter 5.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Chapter 6 CPU SCHEDULING.
More Scheduling cs550 Operating Systems David Monismith.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
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.
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 31 – Multimedia OS (Part 1) Klara Nahrstedt Spring 2011.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
CompSci 143A1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Uniprocessor Scheduling
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.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
CSC 322 Operating Systems Concepts Lecture - 10: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Scheduling.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
CPU SCHEDULING.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
CPU Scheduling Chapter 5.
Chapter 2 Scheduling.
Chapter 8 – Processor Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Operating systems Process scheduling.
CPU SCHEDULING.
Scheduling The art and science of allocating the CPU and other resources to processes (Slides include materials from Operating System Concepts, 7th ed.,
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Module 5: CPU Scheduling
Scheduling 21 May 2019.
Module 5: CPU Scheduling
Presentation transcript:

Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes

Wk 2 – Scheduling 2 CS502 Spring 2006 Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound process Which process should have higher CPU priority? Which process should have higher I/O or disk priority?

Wk 2 – Scheduling 3 CS502 Spring 2006 Process Scheduling When to run scheduler 1.Process create 2.Process exit 3.Process blocks 4.System interrupt Non-preemptive – process runs until it blocks or gives up CPU (1,2,3) Preemptive – process runs for some time unit, then scheduler selects a process to run (1-4)

Wk 2 – Scheduling 4 CS502 Spring 2006 Scheduling - Policies Issues –Fairness – don’t starve process –Priorities – most important first –Deadlines – task X must be done by time t –Optimization – e.g. throughput, response time Reality - No universal scheduling policy –Many models –Determine what to optimize - metrics –Select an appropriate one and adjust based on experience

Wk 2 – Scheduling 5 CS502 Spring 2006 Process Scheduling – System Needs

Wk 2 – Scheduling 6 CS502 Spring 2006 Scheduling - Metrics Simplicity – easy to implement Job latency – time from start to completion Interactive latency – time from action start to expected system response Throughput – number of jobs completed Utilization – keep processor and subset of I/O devices busy Determinism – insure that jobs get done before some time or event Fairness – every job makes progress

Wk 2 – Scheduling 7 CS502 Spring 2006 Batch System Scheduling Note: Number of Processes in Memory determines the degree of multiprogramming

Wk 2 – Scheduling 8 CS502 Spring 2006 Scheduling Policies - FCFS First Come, First Served (FCFS) –Easy to implement –Non-preemptive –Minimizes context switch overhead –Favors compute bound jobs –Short jobs penalized

Wk 2 – Scheduling 9 CS502 Spring 2006 Scheduling Policies – Round Robin Round Robin (RR) –Preemptive –Ready processes given a quantum of time when scheduled –Process runs until it blocks or quantum expires –Suitable for interactive (timesharing) systems –Setting quantum is critical for efficiency

Wk 2 – Scheduling 10 CS502 Spring 2006 Scheduling Policies - Comparison 10 jobs each take 100 seconds - look at when jobs complete FCFS – job 1: 100s, job 2: 200s … job 10:1000s RR –1 sec quantum –Job 1: 991s, job 2 : 992s … RR good for short jobs – worse for long jobs

Wk 2 – Scheduling 11 CS502 Spring 2006 Scheduling Policies – RR example Utilization –A and B compute bound jobs % CPU –C – 1 ms CPU and 10 ms disk I/O –Quantum – 100 ms CPU utilization = ( )/210 = 95.7 % –Quantum – 1 ms (assume 0 overhead) ABCAB(C-I/O)ABABAB ….AB CPU utilization = 100% –Smaller quantum can improve utilization – but consider overhead

Wk 2 – Scheduling 12 CS502 Spring 2006 Scheduling Policies - STCF STCF – shortest time to completion first ( or shortest job first) –Can be preemptive –Good for throughput –Example jobs A – 100, B – 1, C – 2 Done B – 1, C – 3, A – 103 Ave = 35, (for RR (1) about 37) –Reality – knowledge of job runtime??

Wk 2 – Scheduling 13 CS502 Spring 2006 Scheduling Policies - Priority Priority Scheduling –Preemptive –Process are given priorities and ranked Maybe done with multiple queues - multilevel –Highest priority runs next With multilevel queues –Select from highest queue –Round robin within queue –Recalculate priority – many algorithms E.g. increase priority of I/O intensive jobs E.g. favor processes in memory Must still meet system goals – e.g. response time

Wk 2 – Scheduling 14 CS502 Spring 2006 Scheduling Policy - Problems Priority inversion –A has high priority, B has lower priority and B acquires a resources that A needs to progress –A attempts to get resources, fails and busy waits; B never runs –A attempts to get resources, fails and blocks; C (medium) enters system; B never runs Priority scheduling can’t be naive

Wk 2 – Scheduling 15 CS502 Spring 2006 Scheduling Policies - Realtime Real Time System – processes have deadlines –Deadlines known –(usually) preemptive Static algorithm – periodic process behavior –Rate Monotonic Scheduling (RMS) – priority = 1/period Dynamic – aperiodic –Earliest Deadline First (EDF) – select process that must complete the soonest

Wk 2 – Scheduling 16 CS502 Spring 2006 Scheduling - Examples Unix – multilevel - many policies and many policy changes over time Linux – multilevel – 3 major levels –Realtime FIFO –Realtime round robin –Timesharing Win/NT - multilevel –Threads scheduled – fibers not visible to scheduler –Jobs – groups of processes are given quotas that contribute to priorities

Wk 2 – Scheduling 17 CS502 Spring 2006 Scheduling Until now: focus on processes. Going forward: system resources – memory, storage, I/O Space sharing –How can resources be split up? – e.g. disk, memory Time sharing –What gets to use something and for how long? –Whenever there are more requests than can be granted Typically resource can not be divided – CPU, I/O port, … Interesting when can be cheaply preempted

Wk 2 – Scheduling 18 CS502 Spring 2006 Scheduling General theme – what is the “best way” to run n processes on k cpu? ( k < n) Conflicting Objectives – no one “best way” –Latency vs. throughput –Speed vs. fairness Incomplete knowledge –E.g. – does user know how long a job will take Real world limitations –E.g. context switching takes CPU time –Job loads are unpredictable Bottom line – scheduling is hard –Know the models –Adjust based upon experience