OPERATING SYSTEMS SCHEDULING



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

CPU Scheduling. CPU Scheduling

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

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

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

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

ICS Principles of Operating Systems

CPU Scheduling Outline

CPU Scheduling. Core Definitions

W4118 Operating Systems. Instructor: Junfeng Yang

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

Operating System: Scheduling

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

Chapter 5 Process Scheduling

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

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

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

Introduction. Scheduling. Types of scheduling. The basics

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Operating Systems. III. Scheduling.

Operating Systems, 6 th ed. Test Bank Chapter 7

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

Processor Scheduling. Queues Recall OS maintains various queues

Job Scheduling Model

Operating Systems Lecture #6: Process Management

Scheduling Algorithms

Operating Systems Concepts: Chapter 7: Scheduling Strategies

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

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

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

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

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

OS OBJECTIVE QUESTIONS

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

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

PROCESS SCHEDULING ALGORITHMS: A REVIEW

A Comparative Study of CPU Scheduling Algorithms

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

Syllabus MCA-404 Operating System - II

Analysis and Comparison of CPU Scheduling Algorithms

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

Real-Time Scheduling 1 / 39

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

Operating System Tutorial

Linux Process Scheduling Policy

Analysis of Job Scheduling Algorithms in Cloud Computing

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

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

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

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

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

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

Chapter 2: OS Overview

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

Linux O(1) CPU Scheduler. Amit Gud amit (dot) gud (at) veritas (dot) com

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

W4118 Operating Systems. Instructor: Junfeng Yang

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

Comparison between scheduling algorithms in RTLinux and VxWorks

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

Types Of Operating Systems

REAL TIME OPERATING SYSTEMS. Lesson-10:

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

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm

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

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

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

4. Fixed-Priority Scheduling

Efficiency of Batch Operating Systems

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

The International Journal Of Science & Technoledge (ISSN X)

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

Tasks Schedule Analysis in RTAI/Linux-GPL

Lecture 3 Theoretical Foundations of RTOS

Load Balancing Scheduling with Shortest Load First

Efficient Parallel Processing on Public Cloud Servers Using Load Balancing

CPUInheritance Scheduling. UniversityofUtah

CHAPTER 1 INTRODUCTION

Performance Comparison of RTOS

Chapter 3. Operating Systems

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

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

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

OPERATING SYSTEMS STRUCTURES

Real Time Operating System for Embedded DSP Applications

Threads Scheduling on Linux Operating Systems

Real-Time Operating Systems for MPSoCs

Real-time KVM from the ground up

Linux Block I/O Scheduling. Aaron Carroll December 22, 2007

Contributions to Gang Scheduling

Transcription:

OPERATING SYSTEMS SCHEDULING Jerry Breecher 5: CPU- 1

CPU What Is In This Chapter? This chapter is about how to get a process attached to a processor. It centers around efficient algorithms that perform well. The design of a scheduler is concerned with making sure all users get their fair share of the resources. 5: CPU- 2

CPU What Is In This Chapter? Basic Concepts Criteria Algorithms Multiple-Processor Real-Time Thread Operating Systems Examples Java Thread Algorithm Evaluation 5: CPU- 3

Concepts Multiprogramming Jobs User Process CPU - I/O burst cycle A number of programs can be in memory at the same time. Allows overlap of CPU and I/O. (batch) are programs that run without user interaction. (time shared) are programs that may have user interaction. is the common name for both. Characterizes process execution, which alternates, between CPU and I/O activity. CPU times are generally much shorter than I/O times. Preemptive An interrupt causes currently running process to give up the CPU and be replaced by another process. 5: CPU- 4

The Scheduler 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 under 1 and 4 is nonpreemptive All other scheduling is preemptive 5: CPU- 5

The Dispatcher Dispatcher module gives control of the CPU to the process selected by the shortterm 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 5: CPU- 6

Note usage of the words DEVICE, SYSTEM, REQUEST, JOB. Criteria For Performance Evaluation UTILIZATION The fraction of time a device is in use. ( ratio of in-use time / total observation time ) THROUGHPUT The number of job completions in a period of time. (jobs / second ) SERVICE TIME QUEUEING TIME The time required by a device to handle a request. (seconds) Time on a queue waiting for service from the device. (seconds) RESIDENCE TIME The time spent by a request at a device. RESIDENCE TIME = SERVICE TIME + QUEUEING TIME. RESPONSE TIME Time used by a system to respond to a User Job. ( seconds ) THINK TIME The time spent by the user of an interactive system to figure out the next request. (seconds) The goal is to optimize both the average and the amount of variation. (but beware the ogre predictability.) 5: CPU- 7

Behavior Most Processes Don t Use Up Their Quantum! 5: CPU- 8

Algorithms FIRST-COME, FIRST SERVED: ( FCFS) same as FIFO Simple, fair, but poor performance. Average queueing time may be long. What are the average queueing and residence times for this scenario? How do average queueing and residence times depend on ordering of these processes in the queue? 5: CPU- 9

Algorithms EXAMPLE DATA: Process Arrival Service Time Time 1 0 8 2 1 4 3 2 9 4 3 5 FCFS P1 P2 P3 P4 0 8 12 21 26 Average wait = ( (8-0) + (12-1) + (21-2) + (26-3) )/4 = 61/4 = 15.25 Residence Time at the CPU 5: CPU- 10

Algorithms SHORTEST JOB FIRST: Optimal for minimizing queueing time, but impossible to implement. Tries to predict the process to schedule based on previous history. Predicting the time the process will use on its next schedule: t( n+1 ) = w * t( n ) + ( 1 - w ) * T( n ) Here: t(n+1) t(n) is time of next burst. is time of current burst. T(n) is average of all previous bursts. W is a weighting factor emphasizing current or previous bursts. 5: CPU- 11

Algorithms PREEMPTIVE ALGORITHMS: Yank the CPU away from the currently executing process when a higher priority process is ready. Can be applied to both Shortest Job First or to Priority scheduling. Avoids "hogging" of the CPU On time sharing machines, this type of scheme is required because the CPU must be protected from a run-away low priority process. Give short jobs a higher priority perceived response time is thus better. What are average queueing and residence times? Compare with FCFS. 5: CPU- 12

Algorithms EXAMPLE DATA: Process Arrival Service Time Time 1 0 8 2 1 4 3 2 9 4 3 5 Preemptive Shortest Job First P1 P2 P4 P1 P3 0 1 5 10 17 26 Average wait = ( (5-1) + (10-3) + (17-0) + (26-2) )/4 = 52/4 = 13.0 5: CPU- 13

Algorithms PRIORITY BASED SCHEDULING: Assign each process a priority. Schedule highest priority first. All processes within same priority are FCFS. Priority may be determined by user or by some default mechanism. The system may determine the priority based on memory requirements, time limits, or other resource usage. Starvation occurs if a low priority process never runs. Solution: build aging into a variable priority. Delicate balance between giving favorable response for interactive jobs, but not starving batch jobs. 5: CPU- 14

ROUND ROBIN: Use a timer to cause an interrupt after a predetermined time. Preempts if task exceeds it s quantum. Train of events Dispatch Time slice occurs OR process suspends on event Put process on some queue and dispatch next Algorithms Use numbers in last example to find queueing and residence times. (Use quantum = 4 sec.) Definitions: Context Switch Changing the processor from running one task (or process) to another. Implies changing memory. Processor Sharing Use of a small quantum such that each process runs frequently at speed 1/n. Reschedule latency How long it takes from when a process requests to run, until it finally gets control of the CPU. 5: CPU- 15

Algorithms ROUND ROBIN: Choosing a time quantum Too short - inordinate fraction of the time is spent in context switches. Too long - reschedule latency is too great. If many processes want the CPU, then it's a long time before a particular process can get the CPU. This then acts like FCFS. Adjust so most processes won't use their slice. As processors have become faster, this is less of an issue. 5: CPU- 16

EXAMPLE DATA: Process Arrival Service Time Time 1 0 8 2 1 4 3 2 9 4 3 5 Algorithms Note: Example violates rules for quantum size since most processes don t finish in one quantum. Round Robin, quantum = 4, no priority-based preemption P1 P2 P3 P4 P1 P3 P4 P3 0 4 8 12 16 20 24 25 26 Average wait = ( (20-0) + (8-1) + (26-2) + (25-3) )/4 = 74/4 = 18.5 5: CPU- 17

MULTI-LEVEL QUEUES: Algorithms Each queue has its scheduling algorithm. Then some other algorithm (perhaps priority based) arbitrates between queues. Can use feedback to move between queues Method is complex but flexible. For example, could separate system processes, interactive, batch, favored, unfavored processes 5: CPU- 18

Using Priorities Here s how the priorities are used in Windows 5: CPU- 19

Algorithms MULTIPLE PROCESSOR SCHEDULING: Different rules for homogeneous or heterogeneous processors. Load sharing in the distribution of work, such that all processors have an equal amount to do. Each processor can schedule from a common ready queue ( equal machines ) OR can use a master slave arrangement. Real Time : 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. 5: CPU- 20

Linux Two algorithms: time-sharing and real-time Time-sharing Prioritized credit-based process with most credits is scheduled next Credit subtracted when timer interrupt occurs When credit = 0, another process chosen When all processes have credit = 0, recrediting occurs Based on factors including priority and history Real-time Soft real-time Posix.1b compliant two classes FCFS and RR Highest priority process runs first 5: CPU- 21

Algorithm Evaluation How do we decide which algorithm is best for a particular environment? Deterministic modeling takes a particular predetermined workload and defines the performance of each algorithm for that workload. Queueing models. 5: CPU- 22

WRAPUP We ve looked at a number of different scheduling algorithms. Which one works the best is application dependent. General purpose OS will use priority based, round robin, preemptive Real Time OS will use priority, no preemption. 5: CPU- 23