Roadmap. Basic Concepts. Process State. Histogram of CPU-burst Durations. Tevfik Koşar. Alternating Sequence of CPU And I/O Bursts

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

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

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

CPU Scheduling. CPU Scheduling

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

ICS Principles of Operating Systems

W4118 Operating Systems. Instructor: Junfeng Yang

Operating System: Scheduling

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

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

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

Introduction. Scheduling. Types of scheduling. The basics

OPERATING SYSTEMS SCHEDULING

PROCESS SCHEDULING ALGORITHMS: A REVIEW

CPU Scheduling Outline

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

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

A Comparative Study of CPU Scheduling Algorithms

Chapter 5 Process Scheduling

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

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

Operating Systems. III. Scheduling.

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

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

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

Processor Scheduling. Queues Recall OS maintains various queues

Analysis and Comparison of CPU Scheduling Algorithms

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

Operating Systems Lecture #6: Process Management

Operating Systems Concepts: Chapter 7: Scheduling Strategies

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

OS OBJECTIVE QUESTIONS

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

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

Job Scheduling Model

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

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

CPU Scheduling. Core Definitions

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

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

Scheduling Algorithms

Operating Systems, 6 th ed. Test Bank Chapter 7

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

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

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

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

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

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

Far-western University Central Office, Mahendranagar Operating System

Real-Time Scheduling 1 / 39

Efficiency of Batch Operating Systems

A Review on Load Balancing In Cloud Computing 1

Exercises : Real-time Scheduling analysis

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

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

Large Scale Systems Design G52LSS

Today s topic: So far, we have talked about. Question. Task models

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

Operating System Tutorial

Linux Process Scheduling Policy

Devices and Device Controllers

Load Balancing Scheduling with Shortest Load First

Analysis of Job Scheduling Algorithms in Cloud Computing

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

Shrimad Rajchandra Institute of Management & Computer Application

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

CS414 SP 2007 Assignment 1

Syllabus MCA-404 Operating System - II

Scheduling. Monday, November 22, 2004

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

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

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

Project Planning Tools. GANTT Chart. Chapter 7 Project Planning. GANTT Chart (Figure 7.3) CPM Chart (Figure 7.12) PERT Chart (Figure 7.

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.

Comparison between scheduling algorithms in RTLinux and VxWorks

Chapter 2: OS Overview

CPUInheritance Scheduling. UniversityofUtah

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Chapter 3. Operating Systems

OPERATING SYSTEM - VIRTUAL MEMORY

Real-Time Software. Basic Scheduling and Response-Time Analysis. René Rydhof Hansen. 21. september 2010

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

Computer Organization and Components

Performance Comparison of RTOS

Lecture 3 Theoretical Foundations of RTOS

The International Journal Of Science & Technoledge (ISSN X)

Operating Systems 4 th Class

Large Scale Systems Design G52LSS

CS162 Operating Systems and Systems Programming Lecture 15. Page Allocation and Replacement

Chapter 11 I/O Management and Disk Scheduling

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

Efficient Parallel Processing on Public Cloud Servers Using Load Balancing

Talk Announcement CSC Lecture 5 Intra-Domain Routing Protocols. Administrivia. This Time

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Aperiodic Task Scheduling

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Short-Term Scheduling

REAL TIME OPERATING SYSTEMS. Lesson-10:

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

Chapter 7: Deadlocks!

Transcription:

S 421/521 - Operating Systems Fall 212 Lecture - V PU Scheduling - I Tevfik Koşar Roadmap PU Scheduling asic oncepts Scheduling riteria & Metrics ifferent Scheduling lgorithms FFS SJF Priority RR Preemptive vs Non-preemptive Scheduling Gantt harts & Performance omparison University at uffalo September 11 th, 212 1 2 asic oncepts lternating Sequence of PU nd I/O ursts Multiprogramming is needed for efficient PU utilization PU Scheduling: deciding which processes to execute when Process execution begins with a PU burst, followed by an I/O burst PU I/O urst ycle Process execution consists of a cycle of PU execution and I/O wait 3 4 Histogram of PU-burst urations Process State s a process executes, it changes state new: The process is being created ready: The process is waiting to be assigned to a process running: Instructions are being executed waiting: The process is waiting for some event to occur terminated: The process has finished execution 5 6

PU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the PU to one of them! short-term scheduler PU scheduling decisions may take place when a process: 1. Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready 4. Terminates 5. new process arrives Scheduling under 1 and 4 is nonpreemptive/cooperative Once a process gets the PU, keeps it until termination/switching to waiting state/release of the PU ll other scheduling is preemptive Most OS use this ost associated with access to shared data i.e. time quota expires ispatcher ispatcher module gives control of the PU to the process selected by the short-term scheduler; Its function involves: switching context switching to user mode jumping to the proper location in the user program to restart that program ispatch latency time it takes for the dispatcher to stop one process and start another running 7 8 Scheduling riteria Optimization riteria PU utilization keep the PU as busy as possible --> maximize Throughput # of processes that complete their execution per time unit -->maximize Turnaround time amount of time passed to finish execution of a particular process --> minimize i.e. execution time + waiting time Waiting time total amount of time a process has been waiting in the ready queue -->minimize Response time amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment) -->minimize 9 Maximize PU utilization Maximize throughput Minimize turnaround time Minimize waiting time Minimize response time 1 Scheduling Metrics! Scheduling metrics " arrival time t a = time the process became Ready (again) " wait time T w = time spent waiting for the PU " service time T s = time spent executing in the PU " turnaround time T r = total time spent waiting and executing t a = T w + T s First-ome, First-Served (FFS) Scheduling " processes are assigned the PU in the order they request it " when the running process blocks, the first Ready is run next " when a process gets Ready, it is put at the end of the queue #5 arrived T w T s xecution times T r #5 executed T r / T s = 2.5 Mean FFS scheduling policy 11 12

FFS Scheduling - xample Process urst 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 hart for the schedule is: P 1 P 2 P 3 24 27 3 Waiting time for P 1 = ; P 2 = 24; P 3 = 27 verage waiting time: ( + 24 + 27)/3 = 17 13 FFS Scheduling - xample 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 Waiting time for P 1 = 6; P 2 = ; P 3 = 3 verage waiting time: (6 + + 3)/3 = 3 Much better than previous case onvoy effect short process behind long process P 1 3 6 3 14 Shortest-Job-First (SJF) Scheduling Non-Preemptive SJF ssociate with each process the length of its next PU burst. Use these lengths to schedule the process with the shortest time Two schemes: nonpreemptive once PU given to the process it cannot be preempted until completes its PU burst preemptive if a new process arrives with PU burst length less than remaining time of current executing process, preempt. -->This scheme is know as the Shortest-Remaining-Time-First (SRTF) SJF is optimal gives minimum average waiting time for a given set of processes SJF " nonpreemptive, assumes the run times are known in advance " among several equally important Ready jobs (or PU bursts), the scheduler picks the one that will finish the earliest Shortest Job First (SJF) Mean SJF scheduling policy 15 16 Non-Preemptive SJF - xample Process rrival Time urst Time P 1. 7 P 2 2. 4 P 3 4. 1 P 4 5. 4 SJF (non-preemptive) Gantt hart Preemptive SJF (SRT)! Shortest Remaining Time (SRT) " preemptive version of SJF, also assumes known run time " choose the process whose remaining run time is shortest " allows new short jobs to get good service P 1 P 3 P 2 P 4 3 7 8 12 16 Mean verage waiting time = ( + 6 + 3 + 7)/4 = 4 17 SRT scheduling policy 18

xample of Preemptive SJF Priority Scheduling Process rrival Time urst Time P 1. 7 P 2 2. 4 P 3 4. 1 P 4 5. 4 SJF (preemptive) Gantt hart P 1 P 2 P 3 P 2 P 4 P 1 2 4 5 7 11 16 priority number (integer) is associated with each process The PU is allocated to the process with the highest priority (smallest integer highest priority) Preemptive nonpreemptive SJF is a priority scheduling where priority is the predicted next PU burst time Problem Starvation low priority processes may never execute Solution ging as time progresses increase the priority of the process 19 2 xample of Priority Process rrival Time urst Time Priority P 1. 7 2 P 2 2. 4 1 P 3 4. 1 4 P 4 5. 4 3 Priority (non-preemptive) P1 --> P2 --> P4 --> P3 Priority (preemptive)?? 21 ach process gets a small unit of PU time (time quantum), usually 1-1 milliseconds. fter this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the PU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Performance q large FIFO q small q must be large with respect to context switch, otherwise overhead is too high 22 " preemptive FFS, based on a timeout interval, the quantum q " the running process is interrupted by the clock and put last in a FIFO Ready queue; then, the first Ready process is run instead " a crucial parameter is the quantum q (generally ~1 1ms) # q should be big compared to context switch latency (~1µs) # q should be less than the longest PU bursts, otherwise RR degenerates to FFS Mean Mean RR (q = 1) scheduling policy RR (q = 4) scheduling policy 23 24

xample of RR with Time Quantum = 2 Time Quantum and ontext Switch Time Process urst Time P 1 53 P 2 17 P 3 68 P 4 24 For q=2, the Gantt chart is: P 1 P 2 P 3 P 4 P 1 P 3 P 4 P 1 P 3 P 3 2 37 57 77 97 117 121 134 154 162 Typically, higher average turnaround than SJF, but better response 25 26 Turnaround Time Varies With The Time Quantum xercise raw gantt charts, find average turnaround and waiting times for above processes, considering: 1) First ome First Served Scheduling 2) Shortest Job First Scheduling (non-preemptive) 3) Shortest Job First Scheduling (preemptive) 4) Round-Robin Scheduling 5) Priority Scheduling (non-preemptive) 6) Priority Scheduling (preemptive) 27 28 Summary PU Scheduling asic oncepts Scheduling riteria & Metrics ifferent Scheduling lgorithms FFS SJF Priority RR Next Lecture: ontinue PU Scheduling Hmm.. Reading ssignment: hapter 5 from Silberschatz. cknowledgements Operating Systems oncepts book and supplementary material by. Silberschatz, P. Galvin and G. Gagne Operating Systems: Internals and esign Principles book and supplementary material by W. Stallings Modern Operating Systems book and supplementary material by. Tanenbaum R. oursat and M. Yuksel from UNR 29 3