CPU Scheduling. CSCE 313 Introduction to Computer Systems. Intro to Scheduling. CSCE 313: Intro to Computer Systems. Schedulers in the OS

Similar documents
Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

W4118 Operating Systems. Instructor: Junfeng Yang

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

ICS Principles of Operating Systems

CPU Scheduling. CPU Scheduling

Operating System: Scheduling

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

OPERATING SYSTEMS SCHEDULING

CPU Scheduling Outline

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Chapter 5 Process Scheduling

Operating Systems. III. Scheduling.

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Introduction. Scheduling. Types of scheduling. The basics

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

A Comparative Study of CPU Scheduling Algorithms

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

Scheduling Algorithms

Analysis and Comparison of CPU Scheduling Algorithms

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

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

OS OBJECTIVE QUESTIONS

A Group based Time Quantum Round Robin Algorithm using Min-Max Spread Measure

Job Scheduling Model

Operating Systems Lecture #6: Process Management

CPU Scheduling. Core Definitions

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads.

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition

Processor Scheduling. Queues Recall OS maintains various queues

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

CS Fall 2008 Homework 2 Solution Due September 23, 11:59PM

Overview of Presentation. (Greek to English dictionary) Different systems have different goals. What should CPU scheduling optimize?

Operating Systems, 6 th ed. Test Bank Chapter 7

Weight-based Starvation-free Improvised Round-Robin (WSIRR) CPU Scheduling Algorithm

A Priority based Round Robin CPU Scheduling Algorithm for Real Time Systems

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking.

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Konzepte von Betriebssystem-Komponenten. Linux Scheduler. Valderine Kom Kenmegne Proseminar KVBK Linux Scheduler Valderine Kom

REDUCING TIME: SCHEDULING JOB. Nisha Yadav, Nikita Chhillar, Neha jaiswal

Operating System Tutorial

Syllabus MCA-404 Operating System - II

Analysis of Job Scheduling Algorithms in Cloud Computing

Load Balancing Scheduling with Shortest Load First

The International Journal Of Science & Technoledge (ISSN X)

OPERATING SYSTEM - VIRTUAL MEMORY

A LECTURE NOTE ON CSC 322 OPERATING SYSTEM I DR. S. A. SODIYA

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Efficient Parallel Processing on Public Cloud Servers Using Load Balancing

This tutorial will take you through step by step approach while learning Operating System concepts.

Resource Reservation & Resource Servers. Problems to solve

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

Design and performance evaluation of Advanced Priority Based Dynamic Round Robin Scheduling Algorithm (APBDRR)

Real-Time Scheduling (Part 1) (Working Draft) Real-Time System Example

A Review on Load Balancing In Cloud Computing 1

Performance Analysis of Load Balancing Algorithms in Distributed System

THREADS WINDOWS XP SCHEDULING

Efficiency of Batch Operating Systems

A Comparative Performance Analysis of Load Balancing Algorithms in Distributed System using Qualitative Parameters

Factors to Describe Job Shop Scheduling Problem

Scheduling. Monday, November 22, 2004

Real-time scheduling algorithms, task visualization

Common Approaches to Real-Time Scheduling

Real-Time Scheduling 1 / 39

Module 6. Embedded System Software. Version 2 EE IIT, Kharagpur 1

W4118 Operating Systems. Instructor: Junfeng Yang

Chapter 10: Virtual Memory. Lesson 08: Demand Paging and Page Swapping

Linux O(1) CPU Scheduler. Amit Gud amit (dot) gud (at) veritas (dot) com

CS414 SP 2007 Assignment 1

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Load Balancing in Distributed System Using FCFS Algorithm with RBAC Concept and Priority Scheduling

Chapter 2: OS Overview

Real- Time Scheduling

Case Study I: A Database Service

Predictable response times in event-driven real-time systems

CHAPTER 1 INTRODUCTION

Aperiodic Task Scheduling

Server Scheduling to Balance Priorities, Fairness and Average Quality of Service

3. Scheduling issues. Common approaches /1. Common approaches /2. Common approaches / /13 UniPD / T. Vardanega 23/01/2013. Real-Time Systems 1

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

Lecture 3 Theoretical Foundations of RTOS

OPERATING SYSTEMS. Table of Contents. Republic of Cameroon Peace Work Fatherland School Year 2013/2014

Operating System Aspects. Real-Time Systems. Resource Management Tasks

ADAPTIVE LOAD BALANCING ALGORITHM USING MODIFIED RESOURCE ALLOCATION STRATEGIES ON INFRASTRUCTURE AS A SERVICE CLOUD SYSTEMS

218 Chapter 5 CPU Scheduling

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Load Balancing in Distributed System. Prof. Ananthanarayana V.S. Dept. Of Information Technology N.I.T.K., Surathkal

Comparison between scheduling algorithms in RTLinux and VxWorks

4. Fixed-Priority Scheduling

Transcription:

CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313/ 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 1

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. 2

Scheduling Decisions Who is going to use the CPU next?! ready 4 running 2 3 1 waiting non-preemptive 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. preemptive Structure of a Scheduler ready queue PCB scheduler dispatcher CPU select process? restart executing process 3

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 4

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: P 1 P 2 P 3 0 24 27 30 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 5

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 3 6 30 Waiting time for P 1 = 6; P 2 = 0 ; P 3 = 3 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. 6

Example of SJF Process Burst Time P 1 6 P 2 8 P 3 7 P 4 3 SJF scheduling chart P 4 P 1 P 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 7

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. t n = actual length of n 2. tn+ 1 3. a, 0 a 1 4. Define : th = predicted value for CPU burst the next CPU ( 1 a ). t = a t + - t n = 1 n 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 8

Conceptually Priority Queues low priority priority queue priority low priority q=f(p) Selector (compare priorities) Selector (compare priorities) high priority CPU high priority CPU 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 FIFO queue end of time quantum CPU terminate 9

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 10

Turnaround Time Varies With The Time Quantum Multilevel Queue Scheduling 11

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