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

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

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

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

CPU Scheduling: Part I. Operating Systems. Spring CS5212

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

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

CPU scheduling. CPU Scheduling

א א א א א א א א

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

CS 143A - Principles of Operating Systems

Principles of Operating Systems

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

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

CPU Scheduling. Chapter 9

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

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

Scheduling. CSE Computer Systems November 19, 2001

CSE 5343/7343 Fall 2006 PROCESS SCHEDULING

CPU Scheduling. Jo, Heeseung

Simulation of Process Scheduling Algorithms

CPU Scheduling. Jo, Heeseung

CS 153 Design of Operating Systems Winter 2016

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

CSC 553 Operating Systems

Journal of Global Research in Computer Science

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

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

Lecture 11: CPU Scheduling

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

IJCSC VOLUME 5 NUMBER 2 JULY-SEPT 2014 PP ISSN

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

Motivation. Types of Scheduling

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)

Chapter 9 Uniprocessor Scheduling

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

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

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

Asia Pacific Journal of Engineering Science and Technology

SE350: Operating Systems. Lecture 6: Scheduling

Operating System 9 UNIPROCESSOR SCHEDULING

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

Comparative Analysis of Basic CPU Scheduling Algorithms

Pallab Banerjee, Probal Banerjee, Shweta Sonali Dhal

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

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

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Process Scheduling for John Russo generated Mon Nov 07 13:57:15 EST 2011

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

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

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

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

Project 2 solution code

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

CS510 Operating System Foundations. Jonathan Walpole

A Paper on Modified Round Robin Algorithm

CPU Scheduling (Chapters 7-11)

September 30 th, 2015 Prof. John Kubiatowicz

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:

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

Mixed Round Robin Scheduling for Real Time Systems

Analysis of Adaptive Round Robin Algorithm and Proposed Round Robin Remaining Time Algorithm

Operating Systems Process Scheduling Prof. Dr. Armin Lehmann

Uniprocessor Scheduling

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

Queue based Job Scheduling algorithm for Cloud computing

Improvised Optimum Multilevel Dynamic Round Robin Algorithm for Optimizing CPU Scheduling

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

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)?

Advanced Types Of Scheduling

A COMPARATIVE ANALYSIS OF SCHEDULING ALGORITHMS

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.

CS 111. Operating Systems Peter Reiher

CSE 451: Operating Systems Spring Module 8 Scheduling

Operating Systems. Scheduling

Improvement of Queue Management for Real Time Task in Operating System

Design and Performance Evaluation of Smart Job First Dynamic Round Robin (SJFDRR) Scheduling Algorithm with Smart Time Quantum

Efficient Round Robin Scheduling Algorithm with Dynamic Time Slice

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

ENGG4420 CHAPTER 4 LECTURE 3 GENERALIZED TASK SCHEDULER

SELF OPTIMIZING KERNEL WITH HYBRID SCHEDULING ALGORITHM

Homework 2: Comparing Scheduling Algorithms

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

A New Proposed Dynamic Quantum for Priority Based Round Robin Scheduling Algorithm

GENERALIZED TASK SCHEDULER

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

CS Advanced Operating Systems Structures and Implementation Lecture 10. Scheduling (Con t) Real-Time Scheduling.

IJRASET: All Rights are Reserved

DRR Based Job Scheduling for Computational Grid and its Variants

Study and Comparison of VM Scheduling Algorithm in Cloud Computing Using CloudSim Simulator

CS 425 / ECE 428 Distributed Systems Fall 2018

TASK SCHEDULING BASED ON EFFICIENT OPTIMAL ALGORITHM IN CLOUD COMPUTING ENVIRONMENT

CS 425 / ECE 428 Distributed Systems Fall 2017

Comparative Study of Parallel Scheduling Algorithm for Parallel Job

Motivating Examples of the Power of Analytical Modeling

SCHEDULING AND CONTROLLING PRODUCTION ACTIVITIES

Scheduling: Introduction

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

Operating Systems (234123) Spring 2013 Scheduling Dan Tsafrir (18/3/2013, 8/4/2013)

Example. You manage a web site, that suddenly becomes wildly popular. Performance starts to degrade. Do you?

Real-Time Scheduler Design For Embedded System Domain

Transcription:

CSC 4103 - Operating Systems Spring 2008 Lecture - V CPU Scheduling - I Tevfik Ko!ar Louisiana State University January 29 th, 2008 1 Roadmap CPU Scheduling Basic Concepts Scheduling Criteria Different Scheduling Algorithms 2

Basic Concepts Multiprogramming is needed for efficient CPU utilization CPU Scheduling: deciding which processes to execute when Process execution begins with a CPU burst, followed by an I/O burst CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait 3 Alternating Sequence of CPU And I/O Bursts 4

Histogram of CPU-burst Durations 5 CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them! short-term scheduler CPU 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 Scheduling under 1 and 4 is nonpreemptive/cooperative Once a process gets the CPU, keeps it until termination/switching to waiting state/release of the CPU All other scheduling is preemptive Most OS use this Cost associated with access to shared data 6

Process State As 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 7 Dispatcher Dispatcher module gives control of the CPU 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 Dispatch latency time it takes for the dispatcher to stop one process and start another running 8

Scheduling Criteria CPU utilization keep the CPU as busy as possible --> maximize Throughput # of processes that complete their execution per time unit -->maximize Turnaround time amount of time to execute a particular process --> minimize Waiting time 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 Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time Optimization Criteria 10

First-Come, First-Served (FCFS) Scheduling 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 11 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 Much better than previous case Convoy effect short process behind long process 12

Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time Two schemes: nonpreemptive once CPU given to the process it cannot be preempted until completes its CPU burst preemptive if a new process arrives with CPU 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 13 Example of Non-Preemptive SJF Process Arrival Time Burst Time P 1 0.0 7 P 2 2.0 4 P 3 4.0 1 P 4 5.0 4 SJF (non-preemptive) P 1 P 3 P 2 P 4 0 3 7 8 12 16 Average waiting time = (0 + 6 + 3 + 7)/4 = 4 14

Example of Preemptive SJF Process Arrival Time Burst Time P 1 0.0 7 P 2 2.0 4 P 3 4.0 1 P 4 5.0 4 SJF (preemptive) P 1 P 2 P 3 P 2 P 4 P 1 0 2 4 5 7 11 16 Average waiting time = (9 + 1 + 0 +2)/4 = 3 15 Priority Scheduling A priority number (integer) is associated with each process The CPU 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 CPU burst time Problem! Starvation low priority processes may never execute Solution! Aging as time progresses increase the priority of the process 16

Round Robin (RR) Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After 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 CPU 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 17 Example of RR with Time Quantum = 20 Process Burst Time P 1 53 P 2 17 P 3 68 P 4 24 The Gantt chart is: P 1 P 2 P 3 P 4 P 1 P 3 P 4 P 1 P 3 P 3 0 20 37 57 77 97 117 121 134 154 162 Typically, higher average turnaround than SJF, but better response 18

Time Quantum and Context Switch Time 19 Turnaround Time Varies With The Time Quantum 20

Exercise Draw gantt charts, find average turnaround and waiting times for above processes, considering: 1) First Come First Server 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) 21 Summary CPU Scheduling Basic Concepts Scheduling Criteria Different Scheduling Algorithms Hmm.. Next Lecture: Project Overview Reading Assignment: Chapter 5 from Silberschatz. 22

Acknowledgements Operating Systems Concepts book and supplementary material by A. Silberschatz, P. Galvin and G. Gagne Operating Systems: Internals and Design Principles book and supplementary material by W. Stallings Modern Operating Systems book and supplementary material by A. Tanenbaum R. Doursat and M. Yuksel from UNR 23