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



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

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

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

W4118 Operating Systems. Instructor: Junfeng Yang

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

CPU Scheduling Outline

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

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

Scheduling Algorithms

CPU Scheduling. CPU Scheduling

ICS Principles of Operating Systems

Job Scheduling Model

Chapter 5 Process Scheduling

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

CPU Scheduling. Core Definitions

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

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

OPERATING SYSTEMS SCHEDULING

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

Operating Systems Lecture #6: Process Management

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

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

OS OBJECTIVE QUESTIONS

Operating System: Scheduling

Operating Systems. III. Scheduling.

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

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

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

Introduction. Scheduling. Types of scheduling. The basics

Processor Scheduling. Queues Recall OS maintains various queues

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 (CONT D) NESTED SCHEDULING FUNCTIONS

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

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

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Operating Systems, 6 th ed. Test Bank Chapter 7

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

Operating Systems Concepts: Chapter 7: Scheduling Strategies

A Review on Load Balancing In Cloud Computing 1

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

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Real-Time Scheduling 1 / 39

A Comparative Study of CPU Scheduling Algorithms

Understanding Linux on z/vm Steal Time

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

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

Syllabus MCA-404 Operating System - II

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

Linux Process Scheduling Policy

Operating System Tutorial

Efficiency of Batch Operating Systems

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

W4118 Operating Systems. Instructor: Junfeng Yang

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

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

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

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

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

OPERATING SYSTEM - VIRTUAL MEMORY

Analysis and Comparison of CPU Scheduling Algorithms

Introduction. Application Performance in the QLinux Multimedia Operating System. Solution: QLinux. Introduction. Outline. QLinux Design Principles

Devices and Device Controllers

EECS 750: Advanced Operating Systems. 01/28 /2015 Heechul Yun

Why Relative Share Does Not Work

Analysis of Job Scheduling Algorithms in Cloud Computing

Task Scheduling for Multicore Embedded Devices

Job Scheduling for MapReduce

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

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

Operating Systems 4 th Class

ò Scheduling overview, key trade-offs, etc. ò O(1) scheduler older Linux scheduler ò Today: Completely Fair Scheduler (CFS) new hotness

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

Table of Contents. Cisco How Does Load Balancing Work?

Performance Comparison of RTOS

Lecture 36: Chapter 6

Scheduling algorithms for Linux

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

1. Comments on reviews a. Need to avoid just summarizing web page asks you for:

Chapter 3. Operating Systems

White Paper Perceived Performance Tuning a system for what really matters

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Case Study I: A Database Service

Chapter 2: OS Overview

Chapter 11 I/O Management and Disk Scheduling

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

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

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Lecture 3 Theoretical Foundations of RTOS

Intel DPDK Boosts Server Appliance Performance White Paper

CHAPTER 15: Operating Systems: An Overview

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

Quality of Service versus Fairness. Inelastic Applications. QoS Analogy: Surface Mail. How to Provide QoS?

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

Transcription:

Scheduling

Main Points Scheduling policy: what to do next, when there are multiple threads ready to run Or multiple packets to send, or web requests to serve, or Definitions response time, throughput, predictability Uniprocessor policies FIFO, round robin, optimal multilevel feedback as approximation of optimal Multiprocessor policies Affinity scheduling, gang scheduling Queueing theory Can you predict a system s response time?

Example You manage a web site, that suddenly becomes wildly popular. Do you? Buy more hardware? Implement a different scheduling policy? Turn away some users? Which ones? How much worse will performance get if the web site becomes even more popular?

Definitions Task/Job User request: e.g., mouse click, web request, shell command, Latency/response time How long does a task take to complete? Throughput How many tasks can be done per unit of time? Overhead How much extra work is done by the scheduler? Fairness How equal is the performance received by different users? Predictability How consistent is the performance over time?

More Definitions Workload Set of tasks for system to perform Preemptive scheduler If we can take resources away from a running task Work-conserving Resource is used whenever there is a task to run For non-preemptive schedulers, work-conserving is not always better Scheduling algorithm takes a workload as input decides which tasks to do first Performance metric (throughput, latency) as output Only preemptive, work-conserving schedulers to be considered

More Definitions Workload Set of tasks for system to perform Preemptive scheduler If we can take resources away from a running task Work-conserving Resource is used whenever there is a task to run For non-preemptive schedulers, work-conserving is not always better Scheduling algorithm takes a workload as input decides which tasks to do first Performance metric (throughput, latency) as output Only preemptive, work-conserving schedulers to be considered

First In First Out (FIFO) Schedule tasks in the order they arrive Continue running them until they complete or give up the processor Example: memcached Facebook cache of friend lists, On what workloads is FIFO particularly bad?

Shortest Job First (SJF) Always do the task that has the shortest remaining amount of work to do Often called Shortest Remaining Time First (SRTF) Suppose we have five tasks arrive one right after each other, but the first one is much longer than the others Which completes first in FIFO? Next? Which completes first in SJF? Next?

FIFO vs. SJF

Shortest Job First Claim: SJF is optimal for average response time Why? For what workloads is FIFO optimal? Pessimal? Does SJF have any downsides?

Starvation and Sample Bias Suppose you want to compare FIFO and SJF on some sequence of arriving tasks Compute average response time as the average for tasks that start/end in some window Is this valid or invalid?

Round Robin Each task gets resource for a fixed period of time (time quantum) If task doesn t complete, it goes back in line Need to pick a time quantum What if time quantum is too long? Infinite? What if time quantum is too short? One instruction?

Round Robin

Round Robin head Ready queue head Ready queue B C D E C D E A running running A (a) A in execution B (b) A completes its time share Proportionality: turnaround (time spent in the system) proportional to task length Response time upperbounded by the number of processes # ready processes * time share

Round Robin head Ready queue head Ready queue B C D E C D E running running A B (a) A in execution head Ready queue E B C A running D (c) reactivation of A

Round Robin End of time share signaled by the timer Timer interrupt causes the activation of the scheduler The scheduler restarts the timer Scheduler takes over also in case of suspension of the running process Reassigns the CPU and restarts timer In current systems time share around 20-120 msec

Round Robin vs. FIFO Assuming zero-cost time slice, is Round Robin always better than FIFO?

Round Robin vs. FIFO

Round Robin vs. Fairness Is Round Robin always fair?

Mixed Workload Two kind of processes: CPU-bound long CPU bursts with sparse I/O I/O bound short CPU bursts with frequent I/O

Mixed Workload

Max-Min Fairness How do we balance a mixture of repeating tasks: Some I/O bound, need only a little CPU Some compute bound, can use as much CPU as they are assigned One approach: maximize the minimum allocation given to a task Schedule the smallest task first, then split the remaining time using max-min

Multi-level Feedback Queue (MFQ) Goals: Responsiveness Low overhead Starvation freedom Some tasks are high/low priority Fairness (among equal priority tasks) Not perfect at any of them! Used in Linux (and probably Windows, MacOS)

MFQ Set of Round Robin queues Each queue has a separate priority High priority queues have short time slices Low priority queues have long time slices Scheduler picks first thread in highest priority queue Round robin in each queue Tasks start in highest priority queue If time slice expires, task drops one level

MFQ

MFQ Issues with MFQ: Starvation: If all the upper queues are always full of I/O-bound processes A process may change its habits : from CPU-bound to I/O-bound and vice-versa Need for policies to raise up the priority of: I/O bound processes CPU-bound processes that are starving MFQ usually combined with dynamic priorities

Example: scheduling in Windows

Example: scheduling in Windows A new thread starts with priority 8 Priority raised up if : thread reactivated after I/O operation (disk : +1, Serial line: +6, Keyboard: +8, Audio card: +8, ) thread reactivated after waiting on a mutex/semaphore (+1 if in background, +2 if in foreground) Thread didn t run for a given amount of time (priority goes to 15 for two time shares) Priority lowered if thread uses all time share (-1) When a window goes in foreground the time share of its threads is enlarged

Example: scheduling in Windows Inversion of priority A (12) A waiting on sem A (12) A executes wait(sem) and waits running C (8) Sem Sem ready; Should execute signal(sem) But does not have the CPU B (15) (4) 1) 2)

Uniprocessor Summary FIFO is simple and minimizes overhead. If tasks are variable in size, then FIFO can have very poor average response time. If tasks are equal in size, FIFO is optimal in terms of average response time. Considering only the processor, SJF is optimal in terms of average response time. SJF is pessimal in terms of variance in response time.

Uniprocessor Summary If tasks are variable in size, Round Robin approximates SJF. If tasks are equal in size, Round Robin will have very poor average response time. Tasks that intermix processor and I/O benefit from SJF and can do poorly under Round Robin. Max-min fairness can improve response time for I/O-bound tasks. Round Robin and Max-min fairness both avoid starvation. By manipulating the assignment of tasks to priority queues, an MFQ scheduler can achieve a balance between responsiveness, low overhead, and fairness.