Processor Scheduling. Queues Recall OS maintains various queues



Similar documents
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: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

CPU Scheduling. Core Definitions

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

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

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

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

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

Chapter 5 Process Scheduling

CPU Scheduling Outline

Operating Systems. III. Scheduling.

W4118 Operating Systems. Instructor: Junfeng Yang

ICS Principles of Operating Systems

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

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

Operating Systems Lecture #6: Process Management

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

OPERATING SYSTEMS SCHEDULING

Operating Systems Concepts: Chapter 7: Scheduling Strategies

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

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

Operating Systems, 6 th ed. Test Bank Chapter 7

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

Operating System: Scheduling

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

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

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

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

Introduction. Scheduling. Types of scheduling. The basics

OS OBJECTIVE QUESTIONS

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

Syllabus MCA-404 Operating System - II

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

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

Real-Time Scheduling 1 / 39

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

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

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

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

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

Linux Process Scheduling Policy

Job Scheduling Model

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

W4118 Operating Systems. Instructor: Junfeng Yang

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

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

REAL TIME OPERATING SYSTEMS. Lesson-10:

CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203

CS414 SP 2007 Assignment 1

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

What is best for embedded development? Do most embedded projects still need an RTOS?

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

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Scheduling Algorithms

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

Operating System Tutorial

Real- Time Scheduling

A Comparative Study of CPU Scheduling Algorithms

Analysis and Comparison of CPU Scheduling Algorithms

Chapter 1 8 Essay Question Review

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

Lecture 3 Theoretical Foundations of RTOS

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

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

Overview and History of Operating Systems

Real-Time Software. Basic Scheduling and Response-Time Analysis. René Rydhof Hansen. 21. september 2010

Implementing AUTOSAR Scheduling and Resource Management on an Embedded SMT Processor

Predictable response times in event-driven real-time systems

Chapter 2: OS Overview

Completely Fair Scheduler and its tuning 1

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

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

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

Linux Scheduler. Linux Scheduler

Chapter 1 13 Essay Question Review

Analysis of Job Scheduling Algorithms in Cloud Computing

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

CHAPTER 15: Operating Systems: An Overview

The Design and Implementation of Real-Time Schedulers in RED-Linux

Aperiodic Task Scheduling

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

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

4. Fixed-Priority Scheduling

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

Hard Real-Time Linux

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

Threads Scheduling on Linux Operating Systems

Chapter 1: Introduction. What is an Operating System?

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

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 Operating System for Embedded DSP Applications

Real-Time Operating Systems for MPSoCs

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

Types Of Operating Systems

Transcription:

Processor Scheduling Chapters 9 and 10 of [OS4e], Chapter 6 of [OSC]: Queues Scheduling Criteria Cooperative versus Preemptive Scheduling Scheduling Algorithms Multi-level Queues Multiprocessor and Real-Time Scheduling Java Thread Scheduling Queues Recall OS maintains various queues linked lists of process control blocks or thread control blocks not necessarily FIFO ready queue short-term scheduler selects process/thread from this queue for dispatching job queue (batch queue) long-term scheduler selects job from this queue for admission as process to system blocked, ready-suspend, blocked-suspend queues

Scheduling Criteria User-oriented, Performance-related provide acceptable turnaround time for batch jobs maximise number of interactive users receiving acceptable response time maximise percentage of deadlines met for real-time tasks User-oriented, Other predictability of turnaround time or response time

System-oriented, Performance-related maximise throughput i.e., number of processes completed per unit time maximise processor utilisation System-oriented, Other fairness enforce priorities balance resource utilisation Cooperative versus Preemptive Scheduling Short-term scheduler might be invoked after interrupt handled because running process terminated or blocked to give opportunity for preemption e.g., another process arrives at ready queue e.g., allocated time-slice expired running process returns to ready queue N.B. Some OS, e.g., Windows 3.x, do not allow preemption

Scheduling Algorithms When processor becomes free, short-term scheduler uses an algorithm to select process from ready queue and dispatch it Scheduling algorithms may make decisions based upon waiting time w (= current time - arrival time) estimate of service time s (= execution time) e.g., by user (job aborts if over runs) e.g., exponential averaging of previous actual values t(k) for that job s(k+1) = α t(k) + ( 1 - α ) s(k), where 0 < α < 1 of each process in ready queue Effectiveness of algorithms can be calculated (after n processes have completed) from their waiting times w i and actual service times t i mean (i.e.average) absolute waiting time, i.e., (w 1 + + w n ) / n mean normalised waiting time, i.e., (w 1 /t 1 + + w n /t n ) / n Alternatively: effectiveness can be expressed in terms of turnaround time T = w + t mean normalised turnaround time = mean normalised waiting time + 1 First-Come, First-Served select process with maximum w nonpreemptive cheap to implement (FIFO queue) performance of short processes (i.e., with short service time) may be unacceptable e.g., process with service time 100ms comes before one with service time 1ms e.g., convoy effect when I/O-bound processes repeatedly have to wait in ready queue for CPUbound process to finish executing

Round-Robin preemptive (at time quantum) version of FCFS needs hardware support, i.e., timer (time-slicing) fair, in that all processes treated equally good for short processes overhead from process switching versus size of quantum N.B. RR degenerates to FCFS if quantum is made too large Shortest-Process-Next (Shortest-Job-First) select process with minimum s nonpreemptive implemented using priority queue, where shortest service time has highest priority optimal, in that it minimises mean absolute waiting time long processes are penalised and may even starve

Shortest-Remaining-Time preemptive (at arrival of another process) version of SPN no additional interrupts elapsed service time of preempted process must be recorded (or deducted from estimated service time) shortest process never has to wait same disadvantages as SPN i.e., expensive to implement, penalises long processes Highest-Response-Ratio-Next select process with maximum w / s nonpreemptive fair to all processes automatic aging expensive to implement

Normalised Normalised Normalised Normalised Normalised Normalised Multi-level Queues ready queue partitioned into several separate queues e.g., one queue for interactive processes and another for batch jobs e.g., one queue for each priority each queue operates own scheduling algorithm queues themselves are scheduled e.g., process arriving at higher-priority queue preempts process previously dispatched from lower-priority one» danger of starvation for processes in lowest-priority queues e.g., time-slicing with different quanta for each queue

Multi-level Feedback-Queues upon arrival, process may be placed in lower queue than dictated by its priority, if it has already used too much CPU time CPU-bound processes thus give way to I/O-bound and interactive processes process waiting too long is moved to higherpriority queue (aging)

Multiprocessor and Real-Time Scheduling With multiple CPU s scheduling is more complex symmetric multiprocessing ready queue shared by all processors, each running own short-term scheduler cooperation necessary to ensure system data structures updated consistently, process neither lost nor selected by different processors asymmetric multiprocessing one processor runs scheduler and dispatches processes to others Hard real-time systems critical tasks must be completed within deadlines secondary storage (and therefore virtual memory) cannot be used require special-purpose software running on dedicated processor

Soft real-time systems critical processes must be given priority e.g., multimedia, high-speed interactive graphics low dispatch latency insert preemption points in long-duration system calls at safe places in kernel (i.e., system data stuctures must be in consistent state), or make entire kernel preemptible (e.g., Solaris), relying on high-priority process not to access inconsistent data structures priority inversion high-priority process needs resource already in use low-priority process allowed to inherit its priority in order to finish using resource Java Thread Scheduling How does JVM schedule threads? preemptive time-slicing is optional Thread.yield() (cooperative multitasking) prioritised Thread.MIN_PRIORITY Thread.NORM_PRIORITY Thread.MAX_PRIORITY may be changed dynamically with setpriority(n)