Escalonamento de Processos

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

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

CPU Scheduling. CPU Scheduling

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

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

W4118 Operating Systems. Instructor: Junfeng Yang

ICS Principles of Operating Systems

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

OPERATING SYSTEMS SCHEDULING

Operating System: Scheduling

Chapter 5 Process Scheduling

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

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Introduction. Scheduling. Types of scheduling. The basics

Processor Scheduling. Queues Recall OS maintains various queues

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

Operating Systems, 6 th ed. Test Bank Chapter 7

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

CPU Scheduling Outline

Operating Systems. III. Scheduling.

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

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

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

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

PROCESS SCHEDULING ALGORITHMS: A REVIEW

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:

Operating Systems Lecture #6: Process Management

A Comparative Study of CPU Scheduling Algorithms

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

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

OS OBJECTIVE QUESTIONS

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

Job Scheduling Model

Analysis and Comparison of CPU Scheduling Algorithms

CPU Scheduling. Core Definitions

Overview of Presentation. (Greek to English dictionary) Different systems have different goals. What should CPU scheduling optimize?

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Scheduling Algorithms

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

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

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

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

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

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

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

Analysis of Job Scheduling Algorithms in Cloud Computing

A Review on Load Balancing In Cloud Computing 1

Syllabus MCA-404 Operating System - II

Weight-based Starvation-free Improvised Round-Robin (WSIRR) CPU Scheduling Algorithm

Linux Process Scheduling Policy

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

Load Balancing Scheduling with Shortest Load First

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

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

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.

Efficiency of Batch Operating Systems

CS414 SP 2007 Assignment 1

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

Design and performance evaluation of Advanced Priority Based Dynamic Round Robin Scheduling Algorithm (APBDRR)

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

W4118 Operating Systems. Instructor: Junfeng Yang

Scheduling. Monday, November 22, 2004

Operating System Tutorial

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

Chapter 2: OS Overview

CPUInheritance Scheduling. UniversityofUtah

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

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

CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203

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

4. Fixed-Priority Scheduling

Comparison between scheduling algorithms in RTLinux and VxWorks

Performance Comparison of RTOS

Real-time scheduling algorithms, task visualization

Factors to Describe Job Shop Scheduling Problem

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of 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

The International Journal Of Science & Technoledge (ISSN X)

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

<Insert Picture Here> An Experimental Model to Analyze OpenMP Applications for System Utilization

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

Real-Time Scheduling 1 / 39

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Efficient Parallel Processing on Public Cloud Servers Using Load Balancing

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

OPERATING SYSTEMS. Table of Contents. Republic of Cameroon Peace Work Fatherland School Year 2013/2014

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

The Association of System Performance Professionals

III. SCHEDULING MODEL A. Users: The user enters the jobs to be executed on processor in computational grid.

Lecture 3 Theoretical Foundations of RTOS

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

Survey of software architectures: function-queue-scheduling architecture and real time OS

218 Chapter 5 CPU Scheduling

2.2 การจ ดการตารางงานของซ พ ย ( CPU Scheduling )

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

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

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

Case Study I: A Database Service

Transcription:

Escalonamento de Processos SLIDES 6B Short-Term Scheduling Known as the dispatcher Executes most frequently Invoked when an event occurs Clock interrupts I/O interrupts Operating system calls Signals Scheduling Maximize CPU utilization Process execution consists of a cycle of CPU execution and I/O wait: CPU Burst.. I/O Burst Cycle - Adapt the Scheduling Algorithm to the type of the program.

Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term 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. Preemptive vs Non-Preemptive Non-Preemptive Scheduling: once the CPU is allocated to a process, the process keeps the CPU until it terminates or it blocks in a I/O operations and switches to the waiting state (used by Windows.). Preemptive Scheduling: when a new process arrives it can take the CPU out of the running process. Scheduling Criteria CPU utilization keep the CPU as busy as possible. Throughput # of processes that complete their execution per time unit. Turnaround time amount of time to execute a particular process. Waiting time amount of time a process has been waiting in the ready queue. Response time amount of time it takes from when a request was submitted until the first response is produced. Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time

Scheduling Algorithms First-Come, First-Served (FCFS) Process Burst Time P P P Suppose that the processes arrive in the order: P, P, P Arrival time=0,0.,0. The Gantt Chart for the schedule is: P P P 0 7 0 Waiting time for P = 0; P =.9; P = 6.8;;; Average waiting time: (0 + + 7)/ = 7 This is a non-preemptive algorithm. FCFS Scheduling (Cont.) First-Come-First-Served Suppose that the processes arrive in the order P, P, P. The Gantt chart for the schedule is: Process W Arrival Time 0 Service Time (Ts) Start Time 0 Finish Time Turnaround Time (Tr) Ts / Tr P P P X 00 0 00 0 6 0 Y 0 0 00 00 Waiting time for P = 6; P = 0 ; P = Average waiting time: (6 + 0 + )/ = Much better than previous case. Convoy effect: short process behind long process Z mean 00 0 0 99 00.99 6

Shortest-Process-Next (SPN) Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. Two schemes: nonpreemptive once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time (SRT). SPN is optimal gives minimum average waiting time for a given set of processes. Difficulty: how to know the length of the next CPU request. Non-Preemptive SPN Process Arrival Time Burst Time P 0.0 7 P.0 P.0 P.0 SPN (non-preemptive) 0 P P P 7 8 6 Average waiting time = (0 + 6 + + 7)/ = P Example of Preemptive SRT Process Arrival Time Burst Time P 0.0 7 P.0 P.0 P.0 SRT (preemptive) Priority Scheduling A priority number (integer) is associated with each process. The CPU is allocated to the process with the highest priority (smallest integer highest priority). Preemptive Nonpreemptive 0 P P P P P P 7 Average waiting time = (9 + + 0 +)/ = 6 Problem Starvation low priority processes may never execute. Solution Aging as time progresses increase the priority of the process.

Priorities Scheduler will always choose a process of higher priority over one of lower priority. Have multiple ready queues to represent each level of priority. Lower-priority may suffer from starvation allow a process to change its priority based on its age or execution history Starvation: interesting note... When the system managers shutdown the IBM 709 at MIT in 97, they found a low-priority process that had been submitted in 967 and had not yet run... IBM 709 Round Robin (RR) Each process gets a small unit of CPU time (time quantum), usually 0-00 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets /n of the CPU time in chunks of at most q time units at once. No process waits more than (n-)q time units. Performance q large FIFO q small q must be large with respect to context switch, otherwise overhead is too high.

Example of RR with Time Quantum = 0 Process Burst Time P P 7 P 68 P The Gantt chart is: Time Quantum and Context Switch Time P P P P P P P P P P 0 0 7 7 77 97 7 6 Typically, higher average turnaround than SJF, but better response. Turnaround Time Varies With The Time Quantum Highest Response Ratio Next (HRRN) Choose next process with the highest ratio (R): R = time spent waiting + expected service time expected service time This algorithm accounts for the age of the process. Shorted jobs are favored (smaller denominator) But aging without service (waiting time) increases R. 6

Multilevel Queue Ready queue is partitioned into separate queues: - foreground (interactive) - background (batch) Each queue has its own scheduling algorithm, foreground RR background FCFS Scheduling must be done between the queues. Fixed priority scheduling; (i.e., serve all processes from foreground; then from background). Possibility of starvation. Time slice each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR; 0% to background in FCFS Multilevel Queue Scheduling Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way. Multilevel-feedback-queue scheduler defined by the following parameters: number of queues scheduling algorithms for each queue method used to determine when to upgrade a process method used to determine when to demote a process method used to determine which queue a process will enter when that process needs service 7

Multilevel Feedback Queues Multilevel Feedback Queue Three queues: Q 0 time quantum 8 milliseconds Q time quantum 6 milliseconds Q FCFS Scheduling A new job enters queue Q 0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q. At Q job is again served FCFS and receives 6 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q. Scheduling Policies Process Scheduling Example 8

Escalonamento Desenhe o histograma de execução dos processos, usando os seguintes algoritmos: FCFS Round-Robin (q=) Round-Robin (q=) Shortest Process Next (SPN) Shortest Remaining Time (SRT) Highest Response Ratio (HRRN) Feedback (q=) Calcule o Finish-Time, Waiting-Time, Turnaround Time para cada processo. Apresente os valores médios do Waiting Time e do Turnaround Time. First-Come-First-Served (FCFS) 0 0 0 Round-Robin (q=) Shortest Process Next (SPN) 0 0 0 0 0 0 Non-preemptive policy. Process with shortest expected processing time is selected next. Short process jumps ahead of longer processes. 9

Shortest Remaining Time (SRT) 0 0 0 Highest Response Ratio Next (HRRN) 0 0 0 Preemptive version of shortest process next policy. Must estimate processing time. Choose next process with the highest ratio: R = time spent waiting + expected service time expected service time Multilevel Feedback 0 0 0 Penalize jobs that have been running longer. 0

Exercícios Escalonamento Escalonamento Considere o conjunto de 6 processos (P...P6) com o seguinte comportamento: Process Arrival Time Burst Time P 0.0 0 P.0 9 P.0 P.0 7 P.0 Apresente o escalonamento destes processos usando os seguintes algoritmos: - FCFS - SPN (Shortest Process Next) - SRT (Shortest Remaining Time) - Round-Robin (quantum=0) Qual o turnaround time e o waiting time em cada um dos casos para os processos? Apresente também os valores médios. Represente de uma forma gráfica o escalonamento destes processos considerando os seguintes algoritmos: A- Round-Robin (quantum=) B- HRRN C- Priority Scheduling (= prioridade mais alta) D- Multilevel Feedback (considere que existem filas (Q0..Q) com os seguintes algoritmos: RR(), RR(), FCFS) E- SRT Para cada um dos algoritmos apresente uma tabela com os seguintes valores: (a) Finish Time; (b) Turnaround Time; (c) Waiting Time. Qual dos algoritmos apresentou o menor valor médio de Waiting Time?

Quiz#: 7th September Considere o conjunto de processos (P...P) com o seguinte comportamento: Processo Prioridade Tempo de Chegada Tempo de Processamento P 0.0 P. P. P. P. Represente de uma forma gráfica o escalonamento destes processos considerando os seguintes algoritmos: Round-Robin (quantum=) HRRN SRT (Shortest Remaining Time) Priority Scheduling (quantum=) (= prioridade mais alta) Multilevel Feedback (quantum=) Para cada um dos algoritmos apresente uma tabela com os seguintes valores: (a) Finish Time; (b) Turnaround Time; (c) Waiting Time. Qual dos algoritmos apresentou o menor valor médio de Waiting Time?