Scheduling I. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Advanced topics on scheduling

Similar documents
Scheduling I. Today Introduction to scheduling Classical algorithms. Next Time Advanced topics on scheduling

CPU scheduling. CPU Scheduling

Module 5: CPU Scheduling

Chapter 6: CPU Scheduling

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

CPU SCHEDULING RONG ZHENG

CPU Scheduling. CPU Scheduler

CPU Scheduling. Heechul Yun

CSE 380 Computer Operating Systems

Process Scheduling. Process Scheduling. CPU and I/O Bursts. CPU - I/O Burst Cycle. Variations in Bursts. Histogram of CPU Burst Times

CS 550 Operating Systems Spring CPU scheduling I

Last class: Today: Threads. CPU Scheduling

TDDI04, K. Arvidsson, IDA, Linköpings universitet CPU Scheduling. Overview: CPU Scheduling. [SGG7] Chapter 5. Basic Concepts.

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

CHAPTER 5 - PROCESS SCHEDULING

2/5/07 CSE 30341: Operating Systems Principles

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II

Comp 204: Computer Systems and Their Implementation. Lecture 11: Scheduling cont d

Real-time operating systems course. 6 Definitions Non real-time scheduling algorithms Real-time scheduling algorithm

Simulation of Process Scheduling Algorithms

Scheduling. Uwe R. Zimmer & Alistair Rendell The Australian National University

LSN 15 Processor Scheduling

CPU Scheduling Exercises

Half Life Variable Quantum Time Round Robin (HLVQTRR)

ENHANCING CPU PERFORMANCE USING SUBCONTRARY MEAN DYNAMIC ROUND ROBIN (SMDRR) SCHEDULING ALGORITHM

ODSA: A Novel Ordering Divisional Scheduling Algorithm for Modern Operating Systems

Improvising Round Robin Process Scheduling through Dynamic Time Quantum Estimation

DETERMINING THE VARIABLE QUANTUM TIME (VQT) IN ROUND ROBIN AND IT S IMPORTANCE OVER AVERAGE QUANTUM TIME METHOD

Revamped Round Robin Scheduling Algorithm

Design and Performance Evaluation of a New Proposed Shortest Remaining Burst Round Robin (SRBRR) Scheduling Algorithm

Season Finale: Which one is better?

COMP9334: Capacity Planning of Computer Systems and Networks

CS 370. FCFS, SJF and Round Robin. Yashwanth Virupaksha and Abhishek Yeluri

Dynamic Time Quantum based Round Robin CPU Scheduling Algorithm

Queuing Networks. - Outline of queuing networks. - Mean Value Analisys (MVA) for open and closed queuing networks

CIS 4930/6930: Principles of Cyber-Physical Systems

International Journal of Advanced Research in Computer Science and Software Engineering

Journal of Global Research in Computer Science

COMPARATIVE PERFORMANCE ANALYSIS OF MULTI-DYNAMIC TIME QUANTUM ROUND ROBIN (MDTQRR) ALGORITHM WITH ARRIVAL TIME

Real-Time Systems. Event-Driven Scheduling

Real-Time Systems. Event-Driven Scheduling

A NEW PROPOSED DYNAMIC DUAL PROCESSOR BASED CPU SCHEDULING ALGORITHM

Efficient Dual Nature Round Robin CPU Scheduling Algorithm: A Comparative Analysis

Improved Deadline Monotonic Scheduling With Dynamic and Intelligent Time Slice for Real-time Systems

NATCOR: Stochastic Modelling

An Improved Round Robin Approach using Dynamic Time Quantum for Improving Average Waiting Time

Clock-driven scheduling

Task Models and Scheduling

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach

Andrew Morton University of Waterloo Canada

February 2011 Page 23 of 93 ISSN

Analysis of Software Artifacts

A new Hybridized Multilevel Feedback Queue Scheduling with Intelligent Time Slice and its Performance Analysis

PBS: A Unified Priority-Based CPU Scheduler

CEC 450 Real-Time Systems

Real Time Operating Systems

Aperiodic Task Scheduling

Lecture 13. Real-Time Scheduling. Daniel Kästner AbsInt GmbH 2013

Computing the Signal Duration to Minimize Average Waiting Time using Round Robin Algorithm

COMP9334 Capacity Planning for Computer Systems and Networks

Networked Embedded Systems WS 2016/17

Operational Laws Raj Jain

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems

ENHANCING THE CPU PERFORMANCE USING A MODIFIED MEAN- DEVIATION ROUND ROBIN SCHEDULING ALGORITHM FOR REAL TIME SYSTEMS.

Convolution Algorithm

Determining the Optimum Time Quantum Value in Round Robin Process Scheduling Method

Scheduling IoT on to the Cloud : A New Algorithm

Analysis of Round-Robin Implementations of Processor Sharing, Including Overhead

Introduction to Queueing Theory

Proportional Share Resource Allocation Outline. Proportional Share Resource Allocation Concept

3. Scheduling issues. Common approaches 3. Common approaches 1. Preemption vs. non preemption. Common approaches 2. Further definitions

Real-time Scheduling of Periodic Tasks (1) Advanced Operating Systems Lecture 2

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

process arrival time CPU burst time priority p1 0ms 25ms 3 p2 1ms 9ms 1 p3 20ms 14ms 4 p4 32ms 4ms 2

Exercises Stochastic Performance Modelling. Hamilton Institute, Summer 2010

Scheduling Lecture 1: Scheduling on One Machine

Introduction to Queueing Theory

AstroPortal: A Science Gateway for Large-scale Astronomy Data Analysis

M/G/1 and Priority Queueing

Journal of Global Research in Computer Science

Introduction to Queueing Theory

Embedded Systems Development

CS 700: Quantitative Methods & Experimental Design in Computer Science

Real-Time Scheduling. Real Time Operating Systems and Middleware. Luca Abeni

IOE 202: lectures 11 and 12 outline

How to deal with uncertainties and dynamicity?

Queueing systems. Renato Lo Cigno. Simulation and Performance Evaluation Queueing systems - Renato Lo Cigno 1

Today s Agenda: 1) Why Do We Need To Measure The Memory Component? 2) Machine Pool Memory / Best Practice Guidelines

A Utilization Bound for Aperiodic Tasks and Priority Driven Scheduling

CS 453 Operating Systems. Lecture 7 : Deadlock

Real Time Operating Systems

ENHANCING THE CPU PERFORMANCE USING A MODIFIED MEAN- DEVIATION ROUND ROBIN SCHEDULING ALGORITHM FOR REAL TIME SYSTEMS

Real-Time Scheduling and Resource Management

Real-Time and Embedded Systems (M) Lecture 5

CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring / 1

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

Non-Preemptive and Limited Preemptive Scheduling. LS 12, TU Dortmund

Advanced Computer Networks Lecture 3. Models of Queuing

Embedded Systems 14. Overview of embedded systems design

Transcription:

Scheduling I Today! Introduction to scheduling! Classical algorithms Next Time! Advanced topics on scheduling

Scheduling out there! You are the manager of a supermarket (ok, things don t always turn out how we plan them!)! It s a busy time at 5-6PM and you have one register working; how do you optimize the queue to reduce waiting time? You have a handful of customers waiting, each with about equally filled carts A new guy, apparently planning to go on hiding, is now in front of the queue and a bunch of people with 2-3 items wait behind An 8-month expectant mother has joined the back of the queue 2

Scheduling! Problem Several ready processes and much fewer CPUs! A choice has to be made By the scheduler, using a scheduling algorithm! The decision, scheduling, is policy! Context switching is a mechanism 3

Scheduling through time! Early batch systems Just run the next job in the tape! Early timesharing systems Scarce CPU time so scheduling is critical! PCs Commonly one active process so scheduling is easy; with fast & per-user CPU scheduling is not critical! Networked workstations & servers All back again, multiple ready processes & expensive CS, scheduling is critical 4

Environments and goals! Different scheduling algorithms, with different goals, for different application areas Batch Interactive Real-time! Goals for all/most systems Fairness comparable processes getting comparable service Policy enforcement seeing that stated policy is carried out Balance keeping all parts of the system busy (mix pool of processes) 5

Environments and goals! Batch systems Throughput max. jobs per hour Turnaround time min. time bet/ submission & termination CPU utilization keep CPU busy all the time (anything wrong?)! Interactive systems Response time respond to requests quickly (time to start responding) Proportionality meet users expectations! Real-time system Meeting deadlines avoid losing data Predictability avoid quality degradation in multimedia systems! Average, maximum, minimum or variance? 6

Process behavior! Task a request to be scheduled (a process may be responsible for multiple tasks)! Workload a set of tasks for some systems to perform, the input to the scheduling algorithm! Bursts of CPU usage alternate with periods of I/O wait Key to scheduling CPU-bound & I/O bound process As CPU gets faster more I/O bound processes Histogram of CPU-burst times Long CPU burst Waiting for I/O Large number of short CPU bursts Small number of long CPU bursts Short CPU burst 7

When to schedule?! When to make scheduling decisions? 1. At process creation 2. When a process exits 3. When a process blocks on I/O, a semaphore, etc 4. When an I/O interrupts occurs 5. A fix periods of time Need a HW clock interrupting new (1) (2) admitted interrupt exit (4) ready running terminated I/O or event completion (4) dispatched waiting (3) I/O or event wait 8

When to schedule?! A fixed periods of times preemptive and non-preemptive No-preemptive Once a process gets the CPU, it doesn t release it until the process terminates or switches to waiting Preemptive Using a timer, the OS can preempt the CPU even it the thread doesn t relinquish it voluntarily Of course, re-assignment involves overhead 9

And now some example policies! Remember these are example policies in practice, any real system uses some hybrid approach! We will start comparing them based on turnaround time T turnaround = T completion T arrival 10

And now some example policies! Other possible metrics (sometimes in conflict) Maximize CPU utilization Maximize throughput (requests completed / sec) Minimize average response time (avg. time from submission of request to first response) Minimize energy (joules per instruction) subject to some constraint (e.g., frames/sec) 11

First-Come First-Served scheduling! First-Come First-Served (FCFS) Simplest, easy to implement, non-preemptive P 1 0 10 P 2 20 P 3 30 Different burst times Turnaround time: (10 + 20 + 30)/3 = 20 Process Burst Time P1 24 P 2 0 3 P 3 6 P 1 30 P2 3 P3 3 Turnaround time: (30 + 3 + 6)/3 =13 12

FCFS Issues Process Burst Time P1 24 P 1 0 24 P 2 27 P 3 30 P2 3 P3 3 Turnaround time: (24 + 27 + 30)/3 =27! The convoy effect 1 CPU-bound process (burst of 1 sec.) Many I/O-bound ones (needing to read 1000 records) Each I/O-bound process reads one block per sec!! Potentially bad average response time! May lead to poor utilization of resources Poor overlap of CPU and I/O 13

Shortest Job First! Taken from Operation Research 0 P 2 3 P 3 6 Turnaround time: (30 + 3 +6)/3 =13 P 1 30 Process Burst Time P1 24 P2 3 P3 3! Provably optimal wrt average response time First job finishes at time a; second job at time a + b; Mean turnaround time (4a + 3 b + 2c + d)/4 Biggest contributor Job # Finish time 1 a 2 b 3 c 4 d 14

And now a short break 15

Shortest Job First! Another example 0 P 3 1 P 2 5 P 4 9 P 1 16 Turnaround time: (16 + 5 + 1+ 9)/4 =7.75 Process Burst Time P1 7 P2 4 P3 1 P4 4! What if they don t all arrive at the same time? P 1 0 7 P 3 8 P 2 12 P 4 16 Turnaround time: (7 + 11 + 6 + 13)/4 = 9.25 *Note P2 run at 12 but arrived at 1, so it only waited 11; similar with P3 and P4. Process Arrival Burst Time P1 0.0 7 P2 1.0 4 P3 2.0 1 P4 3.0 4 16

Shortest Remaining Time First! A preemptive variation P 1 0 1 P 2 2 P 3 3 P 2 6 P 4 10 P 1 16 Turnaround time: (16 + 5 + 1 + 7)/4 = 7.25 Process Arrival Burst Time P1 0.0 7 P2 1.0 4 P3 2.0 1 P4 3.0 4! Great, but how do you know the burst time? 17

- - Define : Determining length of next CPU burst! Can only estimate length! Typically done using length of previous CPU bursts and exponential averaging - t n = actual lenght of n τ n + 1 = predicted value for the next CPU -α, 0 α 1 th CPU Weight of history ( 1 α). τ n= 1 = α tn + τ n burst burst Most recent information Past history τ 1 = 0.5 t 0 + ( 1 0.5)τ 0 = 8 18

Scheduling the server-side of P2P systems! P2P users response is dominated by download >80% download requests in Kazaa are rejected due to capacity saturation at server peers >50% of all requests for large objects (>100MB) take more than one day & ~20% take over one week to complete! Most implementations use FCFS or PS! Apply SRPT! Work from Northwestern PS Process Sharing FCFS First-Come First-Serve SRPT Shortest-Remaining Processing-Time Mean response time of object download as a function of system load. 19

Priority scheduling! SJF is a special case of priority-based scheduling Priority = reverse of predicted next CPU burst! Pick process with highest priority (lowest number) Process Burst time Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 P 2 0 1 P 5 6 P 1 16 P 3 P 4 18 19 Turnaround time = (16 + 1 + 18 + 19 + 6)/5 = 12 20

Priority scheduling issues! How do you assign priorities?! Starvation With an endless supply of high priority jobs, low priority processes may never execute What other recently discussed algorithm has the same problem?! Solution Increases priority with age, i.e. accumulated waiting time Decrease priority as a function of accumulated processing time Assigned maximum quantum 21

Round-robin scheduling! SJF is not bad if you know burst times or can estimate it fairly well the case in many early batch systems At least when measuring turnaround time!! Time-sharing machines changed it all Users want interactivity Turnaround time is not a good metric for this Response time? Time to first run minus time of arrival 0 P 3 1 P 2 5 P 4 9 P 1 16 Turnaround time: (16 + 5 + 1+ 9)/4 =7.75 Response time: (9 + 1 + 0 + 5)/4 = 3.75 Process Burst Time P1 7 P2 4 P3 1 P4 4 22

Round-robin scheduling! Simple, fair, easy to implement, & widely-used! Each process gets a fix quantum or time slice! When quantum expires, if running preempt CPU! With n processes & quantum q, each one gets 1/n of the CPU time, no-one waits more than (n-1) q to run first (i.e., response time) q = 2 Process Burst Time P 1 0 2 P 2 4 P 3 5 P 4 7 P 1 9 P 2 11 P 4 P 1 P 1 13 15 16 P1 7 P2 4 P3 1 Response time: (0 + 2 + 4 + 5)/4 = 2.75 P4 4 Turnaround time: (16 + 11 + 5 + 13)/4 = 11.25 23

Quantum & Turnaround time! Length of quantum Too short low CPU efficiency (why?) Too long low response time (really long, what do you get?) Commonly ~ 50-100 msec. Largest quantum doesn t imply shortest turnaround times 24

Next time! How do you support responsive, flexible scheduling? Priority? How are priorities set?! How do you optimize turnaround time while minimizing response time? Shortest Job First reduces turnaround time but hurts response time Round Robin reduces response time but hurts average waiting time? 25