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

Similar documents
CPU scheduling. CPU Scheduling

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

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

א א א א א א א א

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

Principles of Operating Systems

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

CPU Scheduling: Part I. Operating Systems. Spring CS5212

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

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

CSE 5343/7343 Fall 2006 PROCESS SCHEDULING

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

Motivation. Types of Scheduling

CPU Scheduling. Jo, Heeseung

Scheduling. CSE Computer Systems November 19, 2001

CPU Scheduling. Jo, Heeseung

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

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

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

CS 153 Design of Operating Systems Winter 2016

CSC 553 Operating Systems

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

Lecture 11: CPU Scheduling

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

Simulation of Process Scheduling Algorithms

Advanced Types Of Scheduling

Chapter 9 Uniprocessor Scheduling

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

Journal of Global Research in Computer Science

Operating System 9 UNIPROCESSOR SCHEDULING

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

SE350: Operating Systems. Lecture 6: Scheduling

CPU Scheduling (Chapters 7-11)

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

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

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CPU Scheduling. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

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

Uniprocessor Scheduling

September 30 th, 2015 Prof. John Kubiatowicz

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

IJCSC VOLUME 5 NUMBER 2 JULY-SEPT 2014 PP ISSN

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:

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

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)

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

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

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

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

A Paper on Modified Round Robin Algorithm

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

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

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

CS 111. Operating Systems Peter Reiher

Asia Pacific Journal of Engineering Science and Technology

Operating Systems. Scheduling

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

Operating Systems Process Scheduling Prof. Dr. Armin Lehmann

Pallab Banerjee, Probal Banerjee, Shweta Sonali Dhal

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

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

CSE 451: Operating Systems Spring Module 8 Scheduling

Improvised Optimum Multilevel Dynamic Round Robin Algorithm for Optimizing CPU Scheduling

Comparative Analysis of Basic CPU Scheduling Algorithms

ENGG4420 CHAPTER 4 LECTURE 3 GENERALIZED TASK SCHEDULER

A COMPARATIVE ANALYSIS OF SCHEDULING ALGORITHMS

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

Improvement of Queue Management for Real Time Task in Operating System

Queue based Job Scheduling algorithm for Cloud computing

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

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.

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

GENERALIZED TASK SCHEDULER

ELC 4438: Embedded System Design Real-Time Scheduling

Clock-Driven Scheduling

SELF OPTIMIZING KERNEL WITH HYBRID SCHEDULING ALGORITHM

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

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

DRR Based Job Scheduling for Computational Grid and its Variants

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

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

Efficient Round Robin Scheduling Algorithm with Dynamic Time Slice

Homework 2: Comparing Scheduling Algorithms

Job Scheduling in Cluster Computing: A Student Project

Mixed Round Robin Scheduling for Real Time Systems

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

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

Motivating Examples of the Power of Analytical Modeling

TASK SCHEDULING BASED ON EFFICIENT OPTIMAL ALGORITHM IN CLOUD COMPUTING ENVIRONMENT

Comparative Study of Parallel Scheduling Algorithm for Parallel Job

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

CS 425 / ECE 428 Distributed Systems Fall 2018

SCHEDULING AND CONTROLLING PRODUCTION ACTIVITIES

Transcription:

Chapter 6: CPU Scheduling Basic Concepts Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation Maximum CPU utilization obtained with multiprogramming CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution 6.1 6.2 Alternating Sequence of CPU And I/O Bursts Histogram of CPU-burst Times 6.3 6.4 CPU Scheduler Dispatcher Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. 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. All other scheduling is preemptive. Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this 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. 6.5 6.6 1

Scheduling Criteria Optimization Criteria CPU utilization keep the CPU as busy as possible Throughput # of processes that complete their execution per time unit Turnaround time amount of time to execute a particular process Waiting time amount of time a process has been waiting in the ready queue 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) Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time 6.7 6.8 First-Come, First-Served (FCFS) Scheduling 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 24 27 3 Waiting time for P 1 = ; P 2 = 24; P 3 = 27 Average waiting time: ( + 24 + 27)/3 = 17 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 Average waiting time: (6 + + 3)/3 = 3 Much better than previous case. Convoy effect short process behind long process P 1 3 6 3 6.9 6.1 Shortest-Job-First (SJR) Scheduling Example of Non-Preemptive SJF 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. Process Arrival Time Burst Time P 1. 7 P 2 2. 4 P 3 4. 1 P 4 5. 4 SJF (non-preemptive) P 1 P 3 P 2 Average waiting time = ( + 6 + 3 + 7)/4-4 P 4 3 7 8 12 16 6.11 6.12 2

Example of Preemptive SJF Determining Length of Next CPU Burst Process Arrival Time Burst Time P 1. 7 P 2 2. 4 P 3 4. 1 P 4 5. 4 SJF (preemptive) P 1 P 2 P 3 P 2 P 4 P 1 Can only estimate the length. Can be done by using the length of previous CPU bursts, using exponential averaging. th 1. t n = actual lenght of n CPU burst 2. τ n + 1 = predicted value for the next CPU burst 3. α, α 1 4. Define: 2 4 5 7 11 16 = α t + ( α ) τ. τ n= 1 n 1 n Average waiting time = (9 + 1 + +2)/4-3 6.13 6.14 Prediction of the Length of the Next CPU Burst Examples of Exponential Averaging α = τ n+1 = τ n Recent history does not count. α =1 τ n+1 = t n Only the actual last CPU burst counts. If we expand the formula, we get: τ n+1 = α t n +(1 - α) α t n -1 + +(1 - α ) j α t n -1 + +(1 - α ) n=1 t n τ Since both α and (1 - α) are less than or equal to 1, each successive term has less weight than its predecessor. 6.15 6.16 Priority Scheduling Round Robin (RR) 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. Each process gets a small unit of CPU time (time quantum), usually 1-1 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 q small q must be large with respect to context switch, otherwise overhead is too high. 6.17 6.18 3

Example of RR with Time Quantum = 2 Time Quantum and Context Switch Time 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 2 37 57 77 97 117 121 134 154 162 Typically, higher average turnaround than SJF, but better response. 6.19 6.2 Turnaround Time Varies With The Time Quantum Multilevel Queue Ready queue is partitioned into separate queues: foreground (interactive) background (batch) Each queue has its own scheduling algorithm, foreground RR background FCFS Scheduling must be done between the queues. Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. Time slice each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 8% to foreground in RR 2% to background in FCFS 6.21 6.22 Multilevel Queue Scheduling Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way. Multilevel-feedback-queue scheduler defined by the following parameters: number of queues scheduling algorithms for each queue method used to determine when to upgrade a process method used to determine when to demote a process method used to determine which queue a process will enter when that process needs service 6.23 6.24 4

Example of Multilevel Feedback Queue Multilevel Feedback Queues Three queues: Q time quantum 8 milliseconds Q 1 time quantum 16 milliseconds Q 2 FCFS Scheduling A new job enters queue Q which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q 1. At Q 1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q 2. 6.25 6.26 Multiple-Processor Scheduling Real-Time Scheduling CPU scheduling more complex when multiple CPUs are available. Homogeneous processors within a multiprocessor. Load sharing Asymmetric multiprocessing only one processor accesses the system data structures, alleviating the need for data sharing. Hard real-time systems required to complete a critical task within a guaranteed amount of time. Soft real-time computing requires that critical processes receive priority over less fortunate ones. 6.27 6.28 Dispatch Latency Algorithm Evaluation Deterministic modeling takes a particular predetermined workload and defines the performance of each algorithm for that workload. Queueing models Implementation 6.29 6.3 5

Evaluation of CPU Schedulers by Simulation Solaris 2 Scheduling 6.31 6.32 Windows 2 Priorities 6.33 6