Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Similar documents
Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

Ch 4 : CPU scheduling

Scheduling of processes

Scheduling. The Basics

Unit 3 : Process Management

8: Scheduling. Scheduling. Mark Handley

Course Syllabus. Operating Systems

Chapter 5: CPU Scheduling

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

Process- Concept &Process Scheduling OPERATING SYSTEMS

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions

PROCESSES & THREADS. Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA Charles Abzug

Chapter 2 Processes and Threads

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CS370 Operating Systems

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Chapter 9. Uniprocessor Scheduling

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization.

1.1 CPU I/O Burst Cycle

Chapter 5: CPU Scheduling

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

COSC243 Part 2: Operating Systems

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Operating Systems. Scheduling

CPU Scheduling Algorithms

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

Operating System Concepts Ch. 5: Scheduling

Scheduling Bits & Pieces

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

Operating Systems: Quiz2 December 15, Class: No. Name:

Frequently asked questions from the previous class survey

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

Midterm Exam. October 20th, Thursday NSC

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

CSE 153 Design of Operating Systems

CS3733: Operating Systems

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

Uniprocessor Scheduling. Aim of Scheduling

Uniprocessor Scheduling. Aim of Scheduling. Types of Scheduling. Long-Term Scheduling. Chapter 9. Response time Throughput Processor efficiency

Operating Systems Unit 3

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

CS370 Operating Systems

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

CHAPTER 2: PROCESS MANAGEMENT

Operating Systems. Lecture Process Scheduling. Golestan University. Hossein Momeni

Department of Computer applications. [Part I: Medium Answer Type Questions]

Properties of Processes

Practice Exercises 305

Last Class: Processes

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

MARUTHI SCHOOL OF BANKING (MSB)

CPU Scheduling: Objectives

Scheduling. Scheduling. Scheduling. Scheduling Criteria. Priorities. Scheduling

CHAPTER NO - 1 : Introduction:

Advanced Operating Systems (CS 202) Scheduling (1)

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

Operating System Review Part

Tasks. Task Implementation and management

What are they? How do we represent them? Scheduling Something smaller than a process? Threads Synchronizing and Communicating Classic IPC problems

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

UNIT:2. Process Management

Process Scheduling. Copyright : University of Illinois CS 241 Staff

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Homework Assignment #5

Frequently asked questions from the previous class survey

CS370 Operating Systems

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

FCM 710: Architecture of Secure Operating Systems

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

Midterm Exam Amy Murphy 6 March 2002

CSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes

Chapter 6: CPU Scheduling

Lecture 9: Midterm Review

CS370 Operating Systems

Subject Teacher: Prof. Sheela Bankar

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

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

OPERATING SYSTEMS UNIT-II

Chapter 9 Uniprocessor Scheduling

CSE 120 Principles of Operating Systems Spring 2017

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5

Job Scheduling. CS170 Fall 2018

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015

Scheduling. Multi-processing. Process Characterization. time. ...makes use of idle. COS450-F18-05-Scheduling - October 8, 2018

Process behavior. Categories of scheduling algorithms.

Department of CSIT ( G G University, Bilaspur ) Model Answer 2013 (Even Semester) - AR-7307

TDIU25: Operating Systems II. Processes, Threads and Scheduling

CS418 Operating Systems

UNIT II PROCESS SCHEDULING AND SYNCHRONIZATION

Transcription:

Review Preview Mutual Exclusion Solutions with Busy Waiting Test and Set Lock Priority Inversion problem with busy waiting Mutual Exclusion with Sleep and Wakeup The Producer-Consumer Problem Race Condition in Producer-Consumer Problem Semaphore The producer-consumer problem with semaphore Dining Philosopher's Problem Mutexes Monitor Scheduling Schedulers Scheduling Algorithms Shortest Job First Shortest Remaining Time Round Robin Priority Queue Guaranteed Scheduling Lottery Scheduling Scheduler Part of operating system that choose the next process for executing its job based on the rule (scheduling algorithm) is called process scheduler. scheduler is designed for making efficient use of the CPU. Long-Term Scheduler Selects a process from the pool of job and load into memory for execution Short-term scheduler selects a process from the ready queue and allocates the CPU. Memory Scheduler schedule which process is in memory and in disk. Three Level Scheduler Effective CPU Scheduler is essential The effective process scheduling algorithm is essential since process switch is very expensive.. All information for the blocked (become ready state or block state) must be saved (state, register, stack pointer, PC,..). The memory map (information regarding memory management) must be saved.. A new process is selected by the scheduler. Information for the new process must be loaded. start run new process. behavior CPU-bounded process a process spend most of their time computing (using CPU) I/O-bounded process a process spend most of their time waiting for I/O. 6

When to make scheduling decision?. When a process switches from the running state to the blocking state (short term scheduler). When a process switches from the running state to the ready state (short term scheduler). When a process terminate its job (long term scheduler). When a process switches from the blocked state to the ready state (short term scheduler) When scheduling takes place only under circumstances,, we say nonpreemptive scheduling scheme; otherwise, the scheduling scheme is called preemptive scheduling scheme. Categories of Scheduling Algorithm Since different system environments have different goals, different scheduling algorithms are needed. Batch System Nonpreemptive or preemptive with long CPU time periods for each process are acceptable. Interactive System CPU times are shared with several users sit on terminals for quick response. Preemptive scheduling scheme is necessary. Real Time System Preemptive scheduling scheme is not necessary sometimes 7 8 Scheduling in the Batch System First Come First Serve (Batch) Goal of batch system Throughput maximize number of process completed per time unit Turnaround time minimize the interval from the time of submission to the time of completion of a process. CPU utilization It is simplest CPU-scheduling algorithm and nonpreemptive. The implementation of the FCFS is easily managed with FIFO queue. When a process enter the ready queue, its PCB (process control block or process table) is linked onto the tail of the queue. When the CPU is free, scheduler chose a process from the head of ready queue. The average waiting time might be long with FCFS. 9 0 First Come First Serve (Batch) Shortest Job First (Batch) CPU time three processes are in the job queue to run. > > The algorithm associated with each process the length of next CPU time FCFS Optimal 0 7 0 Average waiting time = (0++7)/=7 0 6 0 t t CPU run time needed 6 (msec) 8(msec) 7(msec) (msec) Average waiting time = (0++6)/=

Shortest Job First (Batch) FCFS SJF CPU run time needed 6 (msec) 8(msec) 7(msec) (msec) Lets assume arriving times as (for FCFS) > > > 0 6 Average waiting time = (0+6++)/=0. 0 9 6 Average waiting time = (0++9+6)/=7 Shortest Job First (Batch) Shortest Job First algorithm is provably optimal in that it gives the minimal average waiting time for a given set of processes. But real difficulty with the SJF algorithm is knowing the length of CPU request. Since there is no way to know the length of next CPU time for a process The SJF algorithm can not be used for short-term scheduler (CPU scheduler). It can be used for long-term scheduler for the batch system. Since, CPU time for each batch job can be estimated. Shortest Remaining Time (Batch) Shortest Remaining Time (Batch) Preemptive version of the SJF algorithm is Shortest Remaining Time Next algorithm. When a new process is arrives at the ready queue while previous process is executing. The newly arrived process might be shorter than what is left of the current executing process. Arrival Time 0 CPU time 8 9 P 0 0 7 6 Average waiting time = ((0 ) + 0 + (7 ) + ( ))/ = 6. Average Turnaround time = ((7-0) + (-) + (6-)+(0-))/ = 6 Scheduling in Interactive System Round-Robin (Interactive) OS design Goal in Interactive System Fast response time The Round-Robin Scheduling algorithm is designed especially for the timesharing systems. A small unit of time called time quantum is defined (between 0 to 0 millisecond). Ready queue is treated as a circular queue. 7 8

Round-Robin (Interactive) Round-Robin (Interactive) The main issue with round-robin algorithm is the length of the quantum. If quantum is too short, many portion of CPU time are wasted for process switching low CPU utilization. If quantum is too long, slow response time. 9 0 A priority is assigned to each process CPU is allocated to a process based on the priority. Equal priority processes are scheduled in FCFS or Round-Robin based on nonpreemptive or preemptive. How to define a priority to each process? Internal way based on the measurable quantity or quantities to compute the priority of a process. ex) CPU time limits, memory requirements, the number of open files, average I/O bound and CPU/bound ratio. External way based on the importance of the process. Ex) school: faculty have high priority than student. company: A customer who pay more money can get high priority. A major problem with priority scheduling algorithm is the starvation of lower priority process. A solution to the problem of starvation of low priority process is aging. A aging is a technique of gradually increasing the priorities of processes that wait in the system for a long time.

Guaranteed Scheduling (Interactive) Guaranteed scheduling algorithm guarantees fairness by monitoring the amount of CPU time spent by each user and allocating resources (CPU) accordingly. To make fairness, system must keep track of how much CPU each process has had since its creation. If there are n processes in the system, each process will receive /n of the CPU power. Since the amount of CPU time each process has actually used is known, it is fairly easy to compute the ratio of actual CPU time consumed. Based ratio, scheduler select a process for CPU. Lottery Scheduling (Interactive) Lottery ticket is given to each process for various system resources. Whenever a scheduling decision has to be made, a lottery ticket is selected at random and the process holding that ticket gets the resources. 6