Chapter 9. Uniprocessor Scheduling

Similar documents
Scheduling of processes

Chapter 9 Uniprocessor Scheduling

Uniprocessor Scheduling. Aim of Scheduling

Uniprocessor Scheduling. Aim of Scheduling. Types of Scheduling. Long-Term Scheduling. Chapter 9. Response time Throughput Processor efficiency

Uniprocessor Scheduling. Chapter 9

Uniprocessor Scheduling

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Chapter 5: CPU Scheduling

Last Class: Processes

Scheduling. The Basics

Course Syllabus. Operating Systems

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

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Today s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1

CPU Scheduling Algorithms

1.1 CPU I/O Burst Cycle

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Ch 4 : CPU scheduling

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

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

Operating Systems Unit 3

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

COSC243 Part 2: Operating Systems

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

Operating Systems. Scheduling

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

CS3733: Operating Systems

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Unit 3 : Process Management

Properties of Processes

CS370 Operating Systems

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

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Operating System Review Part

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

Scheduling. Scheduling. Scheduling. Scheduling Criteria. Priorities. Scheduling

CS307: Operating Systems

Chapter 5: CPU Scheduling

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

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

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

Operating System Concepts Ch. 5: Scheduling

Scheduling Bits & Pieces

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Chapter 6: CPU Scheduling

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

CSE 120 Principles of Operating Systems Spring 2017

CS370 Operating Systems

8th Slide Set Operating Systems

Start of Lecture: February 10, Chapter 6: Scheduling

CPU Scheduling: Objectives

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

Process- Concept &Process Scheduling OPERATING SYSTEMS

Practice Exercises 305

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

LECTURE 3:CPU SCHEDULING

Chapter 5 CPU scheduling

CHAPTER 2: PROCESS MANAGEMENT

CS370 Operating Systems

8: Scheduling. Scheduling. Mark Handley

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

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

Chapter 5: CPU Scheduling

Operating Systems CS 323 Ms. Ines Abbes

Job Scheduling. CS170 Fall 2018

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

Operating Systems ECE344. Ding Yuan

Process Scheduling. Copyright : University of Illinois CS 241 Staff

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Chapter 6: CPU Scheduling

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization.

Interactive Scheduling

Two Level Scheduling. Interactive Scheduling. Our Earlier Example. Round Robin Scheduling. Round Robin Schedule. Round Robin Schedule

Scheduling in the Supermarket

Titolo presentazione. Scheduling. sottotitolo A.Y Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella

Frequently asked questions from the previous class survey

CPU Scheduling: Part I ( 5, SGG) Operating Systems. Autumn CS4023

CSE 120 Principles of Operating Systems

CSE 4/521 Introduction to Operating Systems

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Scheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher

Announcements/Reminders

Lecture 2 Process Management

Operating Systems. Process scheduling. Thomas Ropars.

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

CS370 Operating Systems

CS697B-f07 Class Notes. Steve Revilak

SMD149 - Operating Systems

CS418 Operating Systems

Transcription:

Operating System Chapter 9. Uniprocessor Scheduling Lynn Choi School of Electrical Engineering

Scheduling Processor Scheduling Assign system resource (CPU time, IO device, etc.) to processes/threads to meet system objectives, such as response time, turnaround time, throughput, or fairness In practice, these goals often conflict Three types of scheduling Long-term scheduling (admission scheduler) Decide which jobs/processes to be admitted to the ready queue Admission to the set of currently executing processes Mid-term scheduling (swapper) Remove processes from main memory and place them on secondary memory, or vice versa Swap in/out processes Short-term scheduling (CPU scheduler or dispatcher) Decide which of the ready, in-memory processes to be executed by the processor following a clock interrupt, IO interrupt, or OS call Execute most frequently

Scheduling and Process State Transitions

Nesting of Scheduling Functions

Queuing Diagram

Long-Term Scheduler Determines which programs are admitted to the system for processing Once admitted a user program becomes a process Controls the degree of multiprogramming The more processes that are created, the smaller the percentage of time that each process can be executed May limit the degree of multiprogramming to provide satisfactory service to the current set of processes Or, may increase the degree of multiprogramming if CPU is idle too long Which jobs to admit next can be First come, first served (FCFS), or Priority, expected execution time, I/O requirements For interactive programs in a time-sharing system OS will accept all authorized comers until the system is saturated

Short-Term Scheduling Criteria The main objective of short-term scheduling is to allocate processor time to optimize system behaviour Can be categorized into two dimensions User-oriented criteria Relate to the behaviour of the system as perceived by the individual user or process (such as response time in an interactive system) Important on virtually all systems System-oriented criteria Focus on efficient utilization of the processor such as throughput Generally of minor importance on single-user systems Performance-related criteria Quantitative and can be measured Example: response time, throughput Not performance-related criteria Qualitative and hard to measure Example: predictability

Scheduling Criteria

Priority Queuing Ready queue with the highest priority Ready queue with the lowest priority May suffer from starvation!

Alternative Scheduling Policies

Selection Function Determines which process, among ready processes, is selected next for execution May be based on priority, resource requirements, or the execution characteristics of the process If based on execution characteristics then important quantities are w = time spent in system so far, waiting e = time spent in execution so far s = total service time required by the process, including e; generally, this quantity must be estimated or supplied by the user

Decision Mode Specifies the instants in time at which the selection function is exercised Two categories Nonpreemptive Once a process is in the running state, it will continue until it terminates or blocks itself for I/O Preemptive Currently running process may be interrupted and moved to ready state by the OS Preemption may occur when new process arrives, on an interrupt that places a blocked process in the Ready queue, or periodically based on a clock interrupt

Process Scheduling Example

Comparison of Scheduling Policies

First-Come First-Served (FCFS) Simplest scheduling policy Also known as first-in-first-out (FIFO) When the current process ceases to execute, the oldest process in the Ready queue is selected Performs much better for long processes than short ones Whenever a short process arrives just after a long one, it waits too long Tends to favor CPU-bound processes over IO-bound ones When a CPU-bound process is running, all the IO-bound processes must wait May result in inefficient use of both CPU and IO devices

Round Robin Uses preemption based on a clock Also known as time slicing because each process is given a slice of time before being preempted Principal design issue is the length of the time quantum, or slice, to be used Time quantum should be slightly longer than a typical interaction Particularly effective in a general-purpose timesharing system or transaction processing system One drawback: CPU-bound processes receive a complete quantum while IO-bound ones may not

Effect of Preemption Time Quantum Size

Effect of Preemption Time Quantum Size

Virtual Round Robin (VRR) Avoid the unfairness of IO-bound processes When an IO-bound process is released from IO block, it is moved to the auxiliary queue Processes in the auxiliary queue get preference over those in the ready queue A process dispatched from the auxiliary queue runs no longer than a time quantum minus the time spent running

Shortest Process Next (SPN) Also called SJF (Shortest Job First) Nonpreemptive policy in which the process with the shortest expected processing time is selected next A short process will jump to the head of the queue Possibility of starvation for longer processes One difficulty is the need to know, or at least estimate, the required processing time of each process If the programmer s estimate is substantially under the actual running time, the system may abort the job

Exponential Smoothing Coefficients

Use Of Exponential Averaging

Use Of Exponential Averaging

Shortest Remaining Time (SRT) Preemptive version of SPN Scheduler always chooses the process that has the shortest expected remaining time The scheduler may preempt the current process when a new process with a short expected processing time becomes ready Risk of starvation for longer processes Should give superior turnaround time performance to SPN because a short job is given immediate preference to a running longer job

Highest Response Ratio Next (HRRN) When the current process completes or is blocked (non-preemptive policy), choose the next process with the greatest ratio (normalized turnaround time) Attractive because it considers the aging of a process While shorter jobs are favored, aging without service increases the ratio so that a long process will eventually win the competition against shorter jobs

Feedback Scheduling Also known as multilevel feedback queue Penalize jobs that have been running longer by placing these jobs into lower priority queues When a process enters the system, it is placed in RQ0. After its first preemption, it is demoted to RQ1. Short processes will complete quickly while long processes may starve To avoid starvation and long turnaround time, RQi may be assigned 2 i time units

Feedback Performance

Fair-Share Scheduling Scheduling decisions are made based on sets of processes rather than each individual process An individual application may be organized as multiple processes/threads From the user perspective, the concern is not how a particular process performs but rather how his/her application (set of processes) performs Each user is assigned a share of the processor Objective is to monitor usage to give fewer resources to users who have had more than their fair share and more to those who have had less than their fair share Scheduling is done on the basis of priority, which considers the process priority, its recent processor usage, and the recent processor usage of the group it belongs.

Fair-Share Scheduler CPU j (i) = CPU j (i-1)/2 CPU utilization by process j during interval i GCPU k (i) = GCPU k (i-1)/2 CPU utilization of group k during interval i P j (i) = Base i + CPU j (i)/2 + GCPU k (i)/(4 * W k ) Base i : base priority of process j W k : weight assigned to group k

Traditional Unix Scheduling Used in both SVR3 and 4.3 BSD UNIX These systems are primarily targeted at the time-sharing interactive environment Designed to provide good response time for interactive users while ensuring that low-priority background jobs do not starve Employs multilevel feedback queue using round robin within each of the priority queues If a running process does not block or complete within one second, it is preempted. Priority is based on process type and execution history

Scheduling Formula

Examples of Traditional UNIX Process Scheduling

Homework 8 Exercise 9.1 Exercise 9.3 Exercise 9.5 Exercise 9.8 Exercise 9.13