CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Similar documents
CPU scheduling. CPU Scheduling

Module 5: CPU Scheduling

Chapter 6: CPU Scheduling

CS 550 Operating Systems Spring CPU scheduling I

CPU Scheduling. CPU Scheduler

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

Last class: Today: Threads. CPU Scheduling

CPU SCHEDULING RONG ZHENG

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

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

2/5/07 CSE 30341: Operating Systems Principles

CPU Scheduling Exercises

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

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

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

Simulation of Process Scheduling Algorithms

CPU Scheduling. Heechul Yun

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

CHAPTER 5 - PROCESS SCHEDULING

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

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

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

CSE 380 Computer Operating Systems

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

Dynamic Time Quantum based Round Robin CPU Scheduling Algorithm

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

LSN 15 Processor Scheduling

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

Improvising Round Robin Process Scheduling through Dynamic Time Quantum Estimation

Half Life Variable Quantum Time Round Robin (HLVQTRR)

Revamped Round Robin Scheduling Algorithm

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

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

Journal of Global Research in Computer Science

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

Season Finale: Which one is better?

February 2011 Page 23 of 93 ISSN

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

Real-Time Systems. Event-Driven Scheduling

EXTRA THRESHOLD IN ROUND ROBIN ALGORITHM IN MULTIPROCESSOR SYSTEM

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

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

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

Journal of Global Research in Computer Science

International Journal of Advanced Research in Computer Science and Software Engineering

A NEW PROPOSED DYNAMIC DUAL PROCESSOR BASED CPU SCHEDULING ALGORITHM

NATCOR: Stochastic Modelling

Real-Time and Embedded Systems (M) Lecture 5

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

Scheduling IoT on to the Cloud : A New Algorithm

CIS 4930/6930: Principles of Cyber-Physical Systems

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

Lecture Note #6: More on Task Scheduling EECS 571 Principles of Real-Time Embedded Systems Kang G. Shin EECS Department University of Michigan

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

Real-Time Systems. Event-Driven Scheduling

ENHANCED ROUND ROBIN ALGORITHM FOR PROCESS SCHEDULING USING VARYING QUANTUM PRECISION

Aperiodic Task Scheduling

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

Priority-driven Scheduling of Periodic Tasks (1) Advanced Operating Systems (M) Lecture 4

Analysis of Software Artifacts

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

Intro to Queueing Theory

Embedded Systems 15. REVIEW: Aperiodic scheduling. C i J i 0 a i s i f i d i

Research Article Designing of Vague Logic Based 2-Layered Framework for CPU Scheduler

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

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

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

How to deal with uncertainties and dynamicity?

Clock-driven scheduling

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

Real-Time Systems. Lecture #14. Risat Pathan. Department of Computer Science and Engineering Chalmers University of Technology

Scheduling Lecture 1: Scheduling on One Machine

Networked Embedded Systems WS 2016/17

Embedded Systems 14. Overview of embedded systems design

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

Andrew Morton University of Waterloo Canada

Contents Preface The Exponential Distribution and the Poisson Process Introduction to Renewal Theory

Introduction to Queueing Theory

There are three priority driven approaches that we will look at

Embedded Systems Development

Convolution Algorithm

Task Models and Scheduling

Operational Laws Raj Jain

CS418 Operating Systems

Section 1.2: A Single Server Queue

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

On-line scheduling of periodic tasks in RT OS

D Praveen Kumar et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (5), 2014,

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

Fair Operation of Multi-Server and Multi-Queue Systems

Scheduling Algorithms for Multiprogramming in a Hard Realtime Environment

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

Real-Time Scheduling and Resource Management

Introduction to Queueing Theory

Real-Time Scheduling

SPT is Optimally Competitive for Uniprocessor Flow

Proportional Share Resource Allocation Outline. Proportional Share Resource Allocation Concept

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

Queueing Theory and Simulation. Introduction

Advanced Computer Networks Lecture 3. Models of Queuing

Transcription:

CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song

Schedulers in the OS CPU Scheduling Structure of a CPU Scheduler Scheduling = Selection + Dispatching Criteria for scheduling Scheduling Algorithms FIFO/FCFS SPF / SRTF Priority - Based

Schedulers start long-term (admission) scheduler short-term (CPU) scheduler suspended ready ready running suspended blocked blocked medium-term (memory) scheduler

Focus: Short-Term Scheduling Recall: Motivation for multiprogramming -- have multiple processes in memory to keep CPU busy. Typical execution profile of a process/thread: start terminate wait for I/O wait for I/O wait for I/O CPU burst CPU burst CPU burst CPU burst CPU scheduler is managing the execution of CPU bursts, represented by processes in ready or running state.

non-preemptive preemptive Scheduling Decisions Who is going to use the CPU next?! ready 4 running 2 3 1 waiting Scheduling decision points: 1. The running process changes from running to waiting (current CPU burst of that process is over). 2. The running process terminates. 3. A waiting process becomes ready (new CPU burst of that process begins). 4. The current process switches from running to ready.

Structure of a Scheduler ready queue PCB scheduler dispatcher CPU select process restart executing process?

What Is a Good Scheduler? Criteria User oriented: Turnaround time : time interval from submission of job until its completion Waiting time : sum of periods spent waiting in ready queue Response time : time interval from submission of job to first response Normalized turnaround time: ratio of turnaround time to service time System oriented: CPU utilization : percentage of time CPU is busy Throughput : number of jobs completed per time unit Any good scheduler should: maximize CPU utilization and throughput minimize turnaround time, waiting time, response time Huh? maximum/minimum values vs. average values vs. variance

Scheduling Algorithms FCFS : First-come-first-served SPN/SJF: Shortest Process Next/Shortest Job First SRT: Shortest Remaining Time priority scheduling RR : Round-robin MLFQ: Multilevel feedback queue scheduling Multiprocessor scheduling

First-Come-First-Served (FCFS/FIFO) append at the end of queue head tail PCB CPU Advantages: very simple Disadvantages: long average and worst-case waiting times poor dynamic behavior (convoy effect): many other processes may wait for one big process to get off the CPU

FCFS Scheduling (cont) Process Burst Time P 1 24 P 2 3 P 3 3 Suppose that the processes arrive in the order: P 1, P 2, P 3 The Gantt Chart for the schedule is: 0 P 1 P 2 P 3 Waiting time for P 1 = 0; P 2 = 24; P 3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 Average response time: (0+24+27)/3=17 Average turnaround time: (24+27+30)/3=27 24 27 30

FCFS Scheduling (cont) Suppose that the processes arrive in the order P 2, P 3, P 1 The Gantt chart for the schedule is: P 2 P 3 P 1 0 Waiting time for P 1 = 6; P 2 = 0 ; P 3 = 3 3 6 30 Average waiting time: (6 + 0 + 3)/3 = 3 Average response time? Turnaround time? Much better than previous case Convoy effect short process behind long process

Shortest Process Next/Shortest Job First determine location in queue (compare next CPU burst lengths) CPU long jobs short jobs Whenever CPU is idle, picks process with shortest next CPU burst. Advantages: minimizes average waiting times. (frequently used in long-term scheduling) Problem: How to determine length of next CPU burst?! Problem: Starvation of jobs with long CPU bursts.

Example of SJF Process Burst Time P 1 6 P 2 8 P 3 7 P 4 3 SJF scheduling chart P 4 P P 1 3 P 2 0 3 9 16 Average waiting time = (0 + 3 + 9+ 16) / 4 = 7 Average turnaround time? Average response time? 24

SJF Minimizes Average Waiting Time Provably optimal: Proof: swapping of jobs P long P short P short P long dw = t short - t long < 0 Example: 6 12 8 4 W = 6+18+26 = 50 6 8 12 4 W = 6+14+26 = 46 6 8 4 12 W = 6+14+18 = 38 6 4 8 12 W = 6+10+18 = 34 4 6 8 12 W = 4+10+18 = 32

Determining Length of Next CPU Burst Can only estimate the length Can be done by using the length of previous CPU bursts, using exponential averaging 1. 2. 3. 4. t n actual length of n n 1, 0 1 Define : CPU burst predicted value for the next CPU th 1. n 1 tn n burst

(Fixed) Priority Scheduling Selector (compare priorities) CPU low priority high priority Whenever CPU is idle, picks process with highest priority. Priority: process class, urgency, pocket depth. Unbounded blocking: Starvation Increase priority over time: aging

Selector (compare priorities) Selector (compare priorities) Conceptually Priority Queues low priority priority queue priority low priority q=f(p) high priority CPU high priority CPU

FIFO queue Round-Robin FIFO with preemption after time quantum Method for time sharing Choice of time quantum: large: FCFS small: Processor sharing Time quantum also defines context-switching overhead end of time quantum CPU terminate

Example of RR with Time Quantum = 4 The Gantt chart is: Process Burst Time P 1 24 P 2 3 P 3 3 P 1 P 2 P 3 P 1 P 1 P 1 P 1 P 1 0 4 7 10 14 18 22 26 30 Average response time: (0+4+7)/3 = 11/3 Average turnaround time: (30+7+10)/3 = 47/3 Average waiting time: (6 + 4 + 7)/3 = 17/3 Typically, higher average turnaround than SJF, but better response

Time Quantum and Context Switch Time

Turnaround Time Varies With The Time Quantum

Multilevel Queue Scheduling

Selector (compare priorities) Multilevel Feedback Queue Scheduling (conceptually) low priority FCFS (quantum = infinity) quantum = 16 ms aging quantum = 4ms quantum = 2 ms demotion high priority