W4118 Operating Systems. Instructor: Junfeng Yang



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

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

ICS Principles of Operating Systems

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

CPU Scheduling. CPU Scheduling

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

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

CPU Scheduling Outline

Chapter 5 Process Scheduling

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

OPERATING SYSTEMS SCHEDULING

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

Operating Systems. III. Scheduling.

PROCESS SCHEDULING ALGORITHMS: A REVIEW

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

Processor Scheduling. Queues Recall OS maintains various queues

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

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

Introduction. Scheduling. Types of scheduling. The basics

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

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

Operating System: Scheduling

Job Scheduling Model

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

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

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

CPU Scheduling. Core Definitions

Scheduling Algorithms

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

Operating Systems Lecture #6: Process Management

Operating Systems Concepts: Chapter 7: Scheduling Strategies

OS OBJECTIVE QUESTIONS

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

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

W4118 Operating Systems. Instructor: Junfeng Yang

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

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

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

Real-Time Scheduling 1 / 39

A Comparative Study of CPU Scheduling Algorithms

Analysis and Comparison of CPU Scheduling Algorithms

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

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

REAL TIME OPERATING SYSTEMS. Lesson-10:

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Analysis of Job Scheduling Algorithms in Cloud Computing

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

Operating Systems, 6 th ed. Test Bank Chapter 7

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

A Review on Load Balancing In Cloud Computing 1

Syllabus MCA-404 Operating System - II

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

Linux scheduler history. We will be talking about the O(1) scheduler

Lecture 3 Theoretical Foundations of RTOS

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

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

Operating System Aspects. Real-Time Systems. Resource Management Tasks

Linux Process Scheduling Policy

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

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

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

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Load Balancing Scheduling with Shortest Load First

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

Performance Comparison of RTOS

Efficiency of Batch Operating Systems

Far-western University Central Office, Mahendranagar Operating System

Factors to Describe Job Shop Scheduling Problem

Operating System Tutorial

Module 6. Embedded System Software. Version 2 EE IIT, Kharagpur 1

Real-time KVM from the ground up

Scheduling policy. ULK3e 7.1. Operating Systems: Scheduling in Linux p. 1

CS414 SP 2007 Assignment 1

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.

Real Time Scheduling Basic Concepts. Radek Pelánek

Chapter 2: OS Overview

Real- Time Scheduling

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

A Survey of Fitting Device-Driver Implementations into Real-Time Theoretical Schedulability Analysis

Completely Fair Scheduler and its tuning 1

3. Scheduling issues. Common approaches /1. Common approaches /2. Common approaches / /13 UniPD / T. Vardanega 23/01/2013. Real-Time Systems 1

Real-time scheduling algorithms, task visualization

Tasks Schedule Analysis in RTAI/Linux-GPL

CHAPTER 15: Operating Systems: An Overview

Common Approaches to Real-Time Scheduling

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

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

CPUInheritance Scheduling. UniversityofUtah

4. Fixed-Priority Scheduling

Aperiodic Task Scheduling

Chapter 3. Operating Systems

Transcription:

W4118 Operating Systems Instructor: Junfeng Yang

Outline Introduction to scheduling Scheduling algorithms 1

Direction within course Until now: interrupts, processes, threads, synchronization Mostly mechanisms From now on: resources Resources: things processes operate upon E.g., CPU time, memory, disk space Mostly policies 2

Preemptible Types of resource OS can take resource away, use it for something else, and give it back later E.g., CPU Non-preemptible OS cannot easily take resource away; have to wait after the resource is voluntarily relinquished E.g., disk space Type of resource determines how to manage 3

Decisions about resource Allocation: which process gets which resources Which resources should each process receive? Space sharing: Controlled access to resource Implication: resources are not easily preemptible Scheduling: how long process keeps resource In which order should requests be serviced? Time sharing: more resources requested than can be granted Implication: Resource is preemptible 4

Role of Dispatcher vs. Scheduler Dispatcher Low-level mechanism Responsibility: context switch Scheduler High-level policy Responsibility: deciding which process to run Could have an allocator for CPU as well Parallel and distributed systems 5

When to schedule? When does scheduler make decisions? 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 Minimal: nonpreemptive? Additional circumstances: preemptive? 6

Outline Introduction to scheduling Scheduling algorithms 7

Overview of scheduling algorithms Criteria: workload and environment Workload Process behavior: alternating sequence of CPU and I/O bursts CPU bound v.s. I/O bound Environment Batch v.s. interactive? Specialized v.s. general? 8

Scheduling performance metrics Min waiting time: don t have process wait long in ready queue Max CPU utilization: keep CPU busy Max throughput: complete as many processes as possible per unit time Min response time: respond immediately Fairness: give each process (or user) same percentage of CPU 9

First-Come, First-Served (FCFS) Simplest CPU scheduling algorithm First job that requests the CPU gets the CPU Nonpreemptive Implementation: FIFO queue 10

Example of FCFS Gantt chart Process Arrival Time Burst Time P 1 0 7 P 2 0 4 P 3 0 1 P 4 0 4 Schedule: P3 Average waiting time: (0 + 7 + 11 + 12)/4 = 7.5 11

Example of FCFS: different arrival order Arrival order: P 3 P 2 P 4 P 1 Gantt chart Schedule: P3 Average waiting time: (9 + 1 + 0 + 5)/4 = 3.75 12

FCFS advantages and disadvantages Advantages Simple Fair Disadvantages waiting time depends on arrival order Convoy effect: short process stuck waiting for long process Also called head of the line blocking 13

Shortest Job First (SJF) Schedule the process with the shortest time FCFS if same time 14

Example of SJF (w/o preemption) Process Arrival Time Burst Time P 1 0 7 P 2 2 4 P 3 4 1 P 4 5 4 Gantt chart Schedule: P3 Arrival: P3 Average waiting time: (0 + 6 + 3 + 7)/4 = 4 15

Shortest Job First (SJF) Schedule the process with the shortest time FCFS if same time Advantages Minimizes average wait time. Provably optimal Disadvantages Not practical: difficult to predict burst time Possible: past predicts future May starve long jobs 16

Shortest Remaining Time First (SRTF) If new process arrives w/ shorter CPU burst than the remaining for current process, schedule new process SJF with preemption Advantage: reduces average waiting time 17

Example of SRTF Gantt chart Schedule: P3 Arrival: P3 Average waiting time: (9 + 1 + 0 + 2)/4 = 3 18

Round-Robin (RR) Practical approach to support time-sharing Run process for a time slice, then move to back of FIFO queue Preempted if still running at end of time-slice How to determine time slice? 19

Example of RR: time slice = 3 Gantt chart with time slice = 3 Arrival: P3 Queue: P3 P3 P3 P3 Average waiting time: (8 + 8 + 5 + 7)/4 = 7 Average response time: (0 + 1 + 5 + 5)/4 = 2.75 # of context switches: 7 20

Example of RR: smaller time slice Gantt chart with time slice = 1 Arrival: P3 Queue: P3 P3 Average waiting time: (8 + 6 + 1 + 7)/4 = 5.5 Average response time: (0 + 0 + 1 + 2)/4 = 0.75 # of context switches: 14 21

Example of RR: larger time slice Gantt chart with time slice = 10 Arrival: P3 Queue: P3 P3 P3 P3 Average waiting time: (0 + 5 + 7 + 7)/4 = 4.75 Average response time: same # of context switches: 3 (minimum) 22

RR advantages and disadvantages Advantages Low response time, good interactivity Fair allocation of CPU across processes Low average waiting time when job lengths vary widely Disadvantages Poor average waiting time when jobs have similar lengths Average waiting time is even worse than FCFS! Performance depends on length of time slice Too high degenerate to FCFS Too low too many context switches, costly 23

Priorities A priority is associated with each process Run highest priority ready job (some may be blocked) Round-robin among processes of equal priority Can be preemptive or nonpreemptive Representing priorities Typically an integer The larger the higher or the lower? 24

Setting priorities Priority can be statically assigned Some always have higher priority than others Problem: starvation Priority can be dynamically changed by OS Aging: increase the priority of processes that wait in the ready queue for a long time 25

Priority inversion High priority process depends on low priority process (e.g. to release a lock) Another process with in-between priority arrives? Solution: priority inheritance Inherit highest priority of waiting process Must be able to chain multiple inheritances Must ensure that priority reverts to original value 26