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

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

CPU Scheduling Algorithms

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Chapter 5: CPU Scheduling

1.1 CPU I/O Burst Cycle

Ch 4 : CPU scheduling

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

Unit 3 : Process Management

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

Course Syllabus. Operating Systems

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

Scheduling of processes

Operating System Concepts Ch. 5: Scheduling

CS370 Operating Systems

Properties of Processes

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

Scheduling. The Basics

Process- Concept &Process Scheduling OPERATING SYSTEMS

8: Scheduling. Scheduling. Mark Handley

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

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

Operating Systems. Scheduling

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

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

CS3733: Operating Systems

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

COSC243 Part 2: Operating Systems

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

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

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

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 3 Solution

Process Scheduling. Copyright : University of Illinois CS 241 Staff

CHAPTER 2: PROCESS MANAGEMENT

CSE 4/521 Introduction to Operating Systems

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

Chapter 6: CPU Scheduling

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

Chapter 5: CPU Scheduling

CS370 Operating Systems

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

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

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

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

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

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

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

CPU Scheduling: Objectives

Operating Systems. Process scheduling. Thomas Ropars.

Operating System Review Part

Chapter 9. Uniprocessor Scheduling

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

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.

Operating Systems Unit 3

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

Advanced Operating Systems (CS 202) Scheduling (1)

FCM 710: Architecture of Secure Operating Systems

CSE 120 Principles of Operating Systems Spring 2017

CISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College

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

CS370 Operating Systems

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

CS418 Operating Systems

Frequently asked questions from the previous class survey

FCM 710: Architecture of Secure Operating Systems

Programming Assignment HW4: CPU Scheduling v03/17/19 6 PM Deadline March 28th, 2019, 8 PM. Late deadline with penalty March 29th, 2019, 8 PM

Last Class: Processes

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

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)

Titolo presentazione. Scheduling. sottotitolo A.Y Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

CS370 Operating Systems

Operating Systems ECE344. Ding Yuan

Job Scheduling. CS170 Fall 2018

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

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Programming Assignment HW5: CPU Scheduling draft v04/02/18 4 PM Deadline April 7th, 2018, 5 PM. Late deadline with penalty April 9th, 2018, 5 PM

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

Scheduling Bits & Pieces

Chapter 6: CPU Scheduling

OPERATING SYSTEMS: Lesson 4: Process Scheduling

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 1 (document version 1.3) Process Simulation Framework

Process behavior. Categories of scheduling algorithms.

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

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

Subject Teacher: Prof. Sheela Bankar

King Saud University. College of Computer & Information Sciences. Information Technology Department. IT425: Operating Systems.

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

Lecture 2 Process Management

Scheduling. Today. Next Time Process interaction & communication

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Process Scheduling Part 2

TDIU25: Operating Systems II. Processes, Threads and Scheduling

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Start of Lecture: February 10, Chapter 6: Scheduling

CSE 153 Design of Operating Systems

LECTURE 3:CPU SCHEDULING

Operating Systems. Figure: Process States. 1 P a g e

Chapter 5 CPU scheduling

Transcription:

Preview Process Scheduler Short Term Scheduler Long Term Scheduler Process Scheduling Algorithms for Batch System First Come First Serve Shortest Job First Shortest Remaining Job First Process Scheduling Algorithms for Interactive System Round Robin Priority Queue CS431 Operating Systems 1

Scheduler Chooses the next process (for execution), based on the rule (scheduling algorithm). Process scheduler is designed for making efficient use of the CPU. Long-Term Scheduler selects a process from the pool of jobs and loads into memory for execution Short-term scheduler selects a process from the ready queue and allocates to the CPU. Memory Scheduler decides which processes should be kept in memory and which ones kept on disk when the number of processes is too large. CS431 Operating Systems 2

Three Level Scheduling CS431 Operating Systems 3

Effective CPU Scheduler is essential The scheduler should make efficient use of the CPU because process switching is very expensive. When switching from user mode to kernel mode: 1. All information for the blocked (become ready state or block state) must be saved (state, register, stack pointer, PC,..) 2. The memory map (information regarding memory management) must be saved. 3. A new process is selected by the scheduler. 4. Information for the new process must be loaded. 5. Start running the new process. CS431 Operating Systems 4

Process behavior CPU-bounded process a process spends most of its time computing (using CPU) I/O-bounded process a process spends most of its time waiting for I/O. CS431 Operating Systems 5

When to make scheduling decision? 1. A process switching from running state to the blocked state 2. A process switching from running state to ready state 3. Terminating a process 4. A process switching from blocked state to ready state CS431 Operating Systems 6

Scheduling Algorithm Goals Different system environments have different goals, and different scheduling algorithms are needed. Batch System Throughput maximize jobs per hour Turnaround time minimize time between submission and termination CPU utilization keep the CPU busy all the time Interactive System Response time response to request quickly Real Time System Meeting deadlines avoid losing data CS431 Operating Systems 7

First Come First Serve (Batch) Non-preemptive Simplest of all CPU-scheduling algorithms Implementation of the FCFS is easily managed with FIFO queue. When a process enters the ready queue, its is put on the end of the queue. When the CPU is free, scheduler chooses a process from the head of ready queue. The average turnaround time might be long with FCFS. CS431 Operating Systems 8

First Come First Serve (Batch) Process P 3 CPU time 24 3 3 3 processes in the job queue in the order of P 3 FCFS P 3 0 24 27 30 Average turnaround time = (24+27+30)/3=27 t Optimal P 3 0 3 6 30 Average turnaround time = (3+6+30)/3=13 t CS431 Operating Systems 9

Shortest Job First (Batch) Non-Preemptive Just pick the shortest job first Process P 3 P 4 CPU run time needed 6(msec) 8(msec) 7(msec) 3(msec) CS431 Operating Systems 10

Shortest Job First (Batch) Process P 3 P 4 CPU run time needed 6(msec) 8(msec) 7(msec) 3(msec) Assume that the arriving times are in the order of > > P 3 >P 4 FCFS P 3 P 4 0 6 14 21 24 Average turnaround time = (6+14+21+24)/4=16.25 SJF P 4 P 3 0 3 9 16 24 Average turnaround time = (3+9+16+24)/4=13 CS431 Operating Systems 11

Shortest Job First (Batch) When all the jobs are available simultaneously, Shortest Job First algorithm is optimal in that it gives the minimal average turnaround time for a given set of processes. CS431 Operating Systems 12

Shortest Remaining Time (Batch) Preemptive version of the SJF algorithm is Shortest Remaining Time Next algorithm. When a new process 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 preemption CS431 Operating Systems 13

Shortest Remaining Time (Batch) Proces s P 3 P 4 Arrival Time 0 1 2 3 CPU time 8 4 9 5 P 4 P3 0 1 2 3 5 10 17 26 Average Turnaround time = ((17-0) + (5-1) + (26-2)+(10-3))/4 = 13 CS431 Operating Systems 14

Round-Robin (Interactive) The Round-Robin Scheduling algorithm is designed especially for the timesharing systems. A small unit of time called time quantum is defined (between 20 to 50 millisecond). Ready queue is treated as a circular queue. CS431 Operating Systems 15

Round-Robin (Interactive) CS431 Operating Systems 16

Round-Robin (Interactive) The main issue with round-robin algorithm is the length of the quantum. If quantum is too short, CPU time are wasted for process switching low CPU utilization. If quantum is too long, slow response time. CS431 Operating Systems 17

Priority Queue Scheduling A priority is assigned to each process CPU is allocated to a process based on the priority. Equal priority processes are scheduled using FCFS or Round-Robin. Example: School: faculty members have higher priority than students. Company: Customers who pay more money can get higher priority. CS431 Operating Systems 18

Priority Queue Scheduling CS431 Operating Systems 19

Priority Queue Scheduling A major problem with priority scheduling algorithm is the starvation of lower priority processes. A solution to the problem of starvation is aging. Aging is a technique of gradually increasing the priorities of processes that wait in the system for a long time. CS431 Operating Systems 20