Motivation. Types of Scheduling

Similar documents
CPU Scheduling. Chapter 9

CSC 553 Operating Systems

Uniprocessor Scheduling

Operating System 9 UNIPROCESSOR SCHEDULING

CSE 5343/7343 Fall 2006 PROCESS SCHEDULING

Chapter 9 Uniprocessor Scheduling

א א א א א א א א

CPU scheduling. CPU Scheduling

CPU Scheduling Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University

CSC 1600: Chapter 5. CPU Scheduling. Review of Process States

Chapter 6: CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. CPU Scheduler. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Intro to O/S Scheduling. Intro to O/S Scheduling (continued)

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

CPU Scheduling CPU. Basic Concepts. Basic Concepts. CPU Scheduler. Histogram of CPU-burst Times. Alternating Sequence of CPU and I/O Bursts

CS 143A - Principles of Operating Systems

CPU Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Unix Scheduler

Announcements. Program #1. Reading. Is on the web Additional info on elf file format is on the web. Chapter 6. CMSC 412 S02 (lect 5)

CPU SCHEDULING. Scheduling Objectives. Outline. Basic Concepts. Enforcement of fairness in allocating resources to processes

Principles of Operating Systems

Comp 204: Computer Systems and Their Implementation. Lecture 10: Process Scheduling

Scheduling Processes 11/6/16. Processes (refresher) Scheduling Processes The OS has to decide: Scheduler. Scheduling Policies

Project 2 solution code

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - V CPU Scheduling - I. University at Buffalo.

Introduction to Operating Systems. Process Scheduling. John Franco. Dept. of Electrical Engineering and Computing Systems University of Cincinnati

Scheduling. CSE Computer Systems November 19, 2001

Reading Reference: Textbook: Chapter 7. UNIX PROCESS SCHEDULING Tanzir Ahmed CSCE 313 Fall 2018

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

CPU Scheduling. Jo, Heeseung

CPU Scheduling (Chapters 7-11)

Advanced Types Of Scheduling

CPU Scheduling. Jo, Heeseung

FIFO SJF STCF RR. Operating Systems. Minati De. Department of Mathematics, Indian Institute of Technology Delhi, India. Lecture 6: Scheduling

Lecture 3. Questions? Friday, January 14 CS 470 Operating Systems - Lecture 3 1

CS510 Operating System Foundations. Jonathan Walpole

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - V CPU Scheduling - I. Louisiana State University.

CPU Scheduling: Part I. Operating Systems. Spring CS5212

Scheduling Algorithms. Jay Kothari CS 370: Operating Systems July 9, 2008

Lecture 6: CPU Scheduling. CMPUT 379, Section A1, Winter 2014 February 5

CPU Scheduling. Disclaimer: some slides are adopted from book authors and Dr. Kulkarni s slides with permission

Lecture 11: CPU Scheduling

CS 153 Design of Operating Systems Winter 2016

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Salisu Aliyu Department of Mathematics, Ahmadu Bello University, Zaria, Nigeria

SE350: Operating Systems. Lecture 6: Scheduling

Simulation of Process Scheduling Algorithms

CSE 451: Operating Systems Spring Module 8 Scheduling

A Paper on Modified Round Robin Algorithm

CS 111. Operating Systems Peter Reiher

CPU Scheduling. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

A COMPARATIVE ANALYSIS OF SCHEDULING ALGORITHMS

Operating Systems Process Scheduling Prof. Dr. Armin Lehmann

Scheduling II. To do. q Proportional-share scheduling q Multilevel-feedback queue q Multiprocessor scheduling q Next Time: Memory management

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Journal of Global Research in Computer Science

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Review of Round Robin (RR) CPU Scheduling Algorithm on Varying Time Quantum

Operating Systems. Scheduling

IJCSC VOLUME 5 NUMBER 2 JULY-SEPT 2014 PP ISSN

Tasks or processes attempt to control or react to external events occuring in real time RT processes must be able to keep up events

CPU scheduling CPU 1. P k P 3 P 2 P 1 CPU 2. CPU n. The scheduling problem: Which jobs should we assign to which CPU(s)?

Process Scheduling Course Notes in Operating Systems 1 (OPESYS1) Justin David Pineda

Clock-Driven Scheduling

Pallab Banerjee, Probal Banerjee, Shweta Sonali Dhal

Improvement of Queue Management for Real Time Task in Operating System

September 30 th, 2015 Prof. John Kubiatowicz

A NOVEL METHOD BASED ON PRIORITY FOR ENHANCEMENT ROUND-ROBIN SCHEDULING ALGORITHM

Lecture Note #4: Task Scheduling (1) EECS 571 Principles of Real-Time Embedded Systems. Kang G. Shin EECS Department University of Michigan

Real Time Scheduling. Real Time Scheduling. Real-Time Scheduling. Scheduling

Recall: FCFS Scheduling (Cont.) Example continued: Suppose that processes arrive in order: P 2, P 3, P 1 Now, the Gantt chart for the schedule is:

Recall: Example of RR with Time Quantum = 20. Round-Robin Discussion

LEAST-MEAN DIFFERENCE ROUND ROBIN (LMDRR) CPU SCHEDULING ALGORITHM

Asia Pacific Journal of Engineering Science and Technology

Process Scheduling I. COMS W4118 Prof. Kaustubh R. Joshi hdp://

GENERALIZED TASK SCHEDULER

Efficient Round Robin Scheduling Algorithm with Dynamic Time Slice

ENGG4420 CHAPTER 4 LECTURE 3 GENERALIZED TASK SCHEDULER

ELC 4438: Embedded System Design Real-Time Scheduling

Homework 2: Comparing Scheduling Algorithms

Queue based Job Scheduling algorithm for Cloud computing

Bhavin Fataniya 1, Manoj Patel 2 1 M.E(I.T) Student, I.T Department, L.D College Of Engineering, Ahmedabad, Gujarat, India ABSTRACT I.

Priority-Driven Scheduling of Periodic Tasks. Why Focus on Uniprocessor Scheduling?

Advanced Operating Systems (CS 202) Scheduling (2)

An operating system executes a variety of programs: Batch system - jobs Time-shared systems - user programs or tasks

Comparative Analysis of Basic CPU Scheduling Algorithms

2. Scheduling issues. Common approaches /2. Common approaches /1. Common approaches / /18 UniPD - T. Vardanega 14/03/2018

TABLE OF CONTENTS CHAPTER NO. TITLE PAGE NO. ABSTRACT LIST OF TABLES LIST OF FIGURES LIST OF SYMBOLS AND ABBREVIATIONS

Improving Throughput and Utilization in Parallel Machines Through Concurrent Gang

Lab: Response Time Analysis using FpsCalc Course: Real-Time Systems Period: Autumn 2015

Improvised Optimum Multilevel Dynamic Round Robin Algorithm for Optimizing CPU Scheduling

3. Scheduling issues. Common approaches /2. Common approaches /1. Common approaches / /17 UniPD / T. Vardanega 06/03/2017

CS162 Operating Systems and Systems Programming Lecture 10. Tips for Handling Group Projects Thread Scheduling

Q1. What is Real time system? Explain the basic model of Real time system. (8)

TASK SCHEDULING BASED ON EFFICIENT OPTIMAL ALGORITHM IN CLOUD COMPUTING ENVIRONMENT

Mixed Round Robin Scheduling for Real Time Systems

Real-Time and Embedded Systems (M) Lecture 4

OPERATING SYSTEMS. Systems and Models. CS 3502 Spring Chapter 03

Periodic task scheduling

LOAD SHARING IN HETEROGENEOUS DISTRIBUTED SYSTEMS

SELF OPTIMIZING KERNEL WITH HYBRID SCHEDULING ALGORITHM

TCSS 422: OPERATING SYSTEMS

Transcription:

Motivation 5.1 Scheduling defines the strategies used to allocate the processor. Successful scheduling tries to meet particular objectives such as fast response time, high throughput and high process efficiency. Types of Scheduling Long-term scheduling The long-term scheduler controls the degree of multiprogramming in the system. It determines when a process is allowed to enter the system. Medium-term scheduling The medium-term scheduler is used for process swapping. Short-term scheduling The short-term scheduler of CPU scheduler selects a process from the ready queue and dispatches it.

Process State Transitions and Scheduling 5.2 New LTS Ready Admit STS Dispatch Time-Out Running Release Exit Activate Suspended Event Occurs Suspend MTS Blocked Event Wait LTS: Long Term Scheduling MTS: Medium Term Scheduling STS: Short Term Scheduling

Queuing Diagram for Scheduling 5.3 Batch Jobs Batch Queue LTS Ready Queue Time - Out STS CPU Release Interactive Users MTS Ready, Suspend Queue MTS Event Wait Event Occurs Event Occurs Blocked, Suspend Queue MTS Blocked Queue

Scheduling Criteria 5.4 User Oriented, Performance-Related Criteria: Response time In an interactive system, this is the time interval between submission of the request (hitting the enter key) and the reception of some response. Turnaround time For batch jobs, this is the time interval between submission of a process and its completion. Deadlines When process deadlines are specified, execution of processes should be prioritized to increase the likelihood that deadlines will be met. Especially important for some critical real-time systems. User Oriented, Other Criteria: Predictability A job should run in about the same amount of time and at about the same cost independent of the load on the system.

Scheduling Criteria (cont.) 5.5 System Oriented, Performance-Related Criteria: Throughput Throughput is the number of processes completed per unit of time. Since short response times may involve considerable context switching, high throughput may be somewhat compromised by short response times. Processor utilization This is the percentage of time that the processor is busy. System Oriented, Other Criteria: Fairness Unless there is a priority mechanism in place, the system should give processes equal opportunities to secure resources including the processor itself. In particular, no process should suffer starvation. Enforcing priorities The scheduling policy should favour processes with a higher priority. Balancing resources The scheduling policy should keep the resources of the system busy.

Process Priorities Process priorities can be facilitated by using multiple ready queues. 5.6 The dispatcher will select processes from queue RQ j only if queue RQ i is empty (for all i<j). To prevent starvation of processes in the lower priority queues, we can use an aging policy that allows a process to move up to a higher priority queue if it has not been dispatched for some predetermined length of time. Preemption RQ0 Dispatch CPU Release Admit RQ1... Multiple Ready Queues Event Wait RQn Aging Event Occurs Blocked Queue

5.7 Priority Policies An OS may have a policy that decides on the priority (i.e. which ready queue) is to be used for both newly admitted processes and processes returning to the ready queue. This may depend on: inherent priority of the process predicted execution time recent request for I/O an aging policy.

5.8 Nonpreemptive Preemptive vs. Nonpreemptive If the process is in a running state, it stays in that state until it terminates or blocks itself to wait for an I/O completion or some OS service. (NO time slicing!) Preemptive The currently running process may be interrupted and moved to the ready state by the OS. Examples: - time slicing - SRT (to be described later) We now consider various scheduling algorithms.

First-Come, First-Served Scheduling 5.9 Strategy: As each process becomes ready, it joins the ready queue. When the currently running process stops, the oldest process is next selected from the ready queue. FCFS is nonpreemptive. Pro: FCFS is simple and has the least overhead. Process starvation cannot occur. Con: FCFS tends to penalize short processes and I/O bound processes. Since processes execute to completion CPU bound processes are favored over I/O bound processes. Response times may be too long. (bad for a multiprocessor environment) Note: Despite the shortcomings, it is worthwhile to study FCFS as a starting point for other more sophisticated strategies.

Round-Robin Scheduling A Preemptive Strategy: A clock interrupt is generated at regular intervals to limit execution times The interrupt defines a time slice for a process. 5.10 When the interrupt occurs, the currently running process is preempted (placed on the ready queue) and the next process to be dispatched is taken from the ready queue on a FCFS basis. So: RR is essentially FCFS + time slicing. RR involves more overhead (throughput is decreased) but the CPU is shared in a more equitable fashion. The time quantum should be slightly greater than the time required for a typical transaction. Note: fraction of time that process runs is q/(q+v) where v represents overhead time. Pro: RR is very effective in multi-user time-sharing environments and provides good response times for short processes. Process starvation is not possible. Con: There is tendency to favor CPU bound processes over I/O bound processes the latter miss out on full time slices since they frequently block to do I/O.

Strategy: Virtual RR Scheduling This is the same as RR except that an auxiliary queue is used to hold processes that have completed and I/O wait. The auxilliary queue has a higher dispatch priority than the ready queue. I/O bound processes now do better. 5.11 Admit Ready Queue Dispatch CPU Time-Out Release Auxilliary Queue I/O 1 Occurs I/O 2 Occurs I/O n Occurs I/O Queue 1 I/O Queue 2... I/O Queue n I/O 1 Wait I/O 2 Wait I/O n Wait

Shortest Process Next Scheduling The SPN Strategy: The process with the shortest expected process time is selected next. SPN is nonpreemptive. SPN approximates the idealized (optimal) strategy of dispatching the process with the smallest next CPU burst. If this could be done it would give us the optimal strategy in providing the minimum average wait time. SPN attempts to predict the length of the next CPU burst by working with previous behaviour. A common approach is to use an exponential average: S n+1 = αt n + (1-α)S n where: S n = predicted CPU burst for the n th dispatch T n = actual CPU burst for the n th dispatch. Usually α may be chosen as 0.5 (perhaps a bit more). A high value of α will quickly reflect a rapid change in CPU bursts. Pro: SPN provides high throughput and good response times for short processes. Con: Starvation is possible and there is no preemption. 5.12

Effect of SPN Consider a ready queue containing three processes with next CPU bursts of: 12, 3, and 9. 5.13 Scenario A: running the processes in a non-spn order: 12 9 3 Response times: 12 21 24 Average Response Time = (12+21+24) / 3 = 19 Scenario B: running the processes in the SPN order: 3 9 12 Response times: 3 12 24 Average Response Time = (3+12+24) / 3 = 13

Shortest Remaining Time Scheduling (SRT) 5.14 Strategy: Pro: The dispatcher chooses the process that has the shortest expected remaining CPU burst. The preemptive version of SPN. If a new process in the ready queue has a predicted CPU burst that is shorter than the currently running process the dispatcher will let it run by preempting the running process. Overhead is somewhat higher than SPN but the benefits are worth the extra expense. SRT provides high throughput and good response times. Con: Process starvation is possible.

Highest Response Ratio Next Scheduling A Non-preemptive Strategy: In an attempt to minimize the normalized turnaround time (ratio of turnaround time to service time) we choose the ready process with the greatest response ratio RR = (w + s)/s. Here w is the time spent waiting for the CPU and s is the expected service time (CPU burst). By picking the largest RR we help to reduce w so that the average normalized turnaround time is also reduced. As for SRT and SPN the service time s is evaluated by prediction using exponential averaging. Note that aged processes (no CPU activity for a long time) will automatically get preference. HRRN is a good blend of FCFS and SPN. Pro: Throughput is high and response time is good. There is a good balance in the treatment of long and short processes Process starvation is not possible. Con: Overhead can be high. 5.15

Multilevel Feedback Scheduling 5.16 Strategy: Preemptive scheduling is done with a dynamic priority mechanism using multiple priority queues. The idea is to automatically separate processes with different CPU-burst lengths. A process starts at a particular queue level. Each time a process is preempted by the end of a time slice it goes to a queue with a priority one level lower than the one just used. Within each queue FCFS is used except for the lowest level queue which uses round-robin. The effect is to penalize jobs that have longer CPU-bursts since short jobs complete before going into lower level queues. Short burst processes (I/O bound and interactive) tend to stay in the higher queues. The quantum duration may be longer for successively lower queues. Does not depend on CPU burst prediction as does SPN, SRT, and HRRN.

5.17 Multilevel Feedback Scheduling (cont.) Ready Queues: CPU Release Admit RQ0 RQ1 Dispatch to RQ 1 RQ2 to RQ 2... to RQ 3 RQn... from RQ n-1 via CPU Not Shown: paths leaving the CPU going to the wait event queues. After an event occurs, the process goes back to the same queue.

Multilevel Feedback Scheduling (cont.) Pro: Feedback provides a simple yet effective strategy. It can be modified for various needs (see the NT approach later). Con: I/O-bound processes tend to be favoured and starvation is possible. To avoid starvation we can promote older processes to a higher-priority queue. Design aspects: The multilevel feedback scheduling strategy covers a variety of different possibilities specified by the following parameters: the number of queues the scheduling algorithm used for each queue the policy used to upgrade a process in order to avoid starvation the policy used to determine the starting queue for a process having its first CPU burst. the policy used for demotion in the queues. 5.18