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.

Similar documents
Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

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)

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

Uniprocessor Scheduling. Aim of Scheduling

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

Scheduling of processes

Chapter 9 Uniprocessor Scheduling

Uniprocessor Scheduling. Chapter 9

Chapter 9. Uniprocessor Scheduling

Uniprocessor Scheduling

Last Class: Processes

Chapter 5: CPU Scheduling

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

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

Operating Systems. Scheduling

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

Course Syllabus. Operating Systems

Scheduling. The Basics

8: Scheduling. Scheduling. Mark Handley

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

CS370 Operating Systems

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

Scheduling in the Supermarket

CS3733: Operating Systems

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

Scheduling Bits & Pieces

Unit 3 : Process Management

Properties of Processes

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

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

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

Operating Systems ECE344. Ding Yuan

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

Operating System Concepts Ch. 5: Scheduling

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

Announcements/Reminders

CS370 Operating Systems

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

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

Process Scheduling. Copyright : University of Illinois CS 241 Staff

CPU Scheduling Algorithms

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

COSC243 Part 2: Operating Systems

CPU Scheduling: Objectives

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

Practice Exercises 305

OPERATING SYSTEM. The Process. Introduction Process creation & termination Process state diagram Process scheduling & its criteria

Scheduling. Today. Next Time Process interaction & communication

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

Ch 4 : CPU scheduling

CSE 120 Principles of Operating Systems Spring 2017

Today s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1

Chapter 5: CPU Scheduling

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

Process- Concept &Process Scheduling OPERATING SYSTEMS

Chapter 5: CPU Scheduling

1.1 CPU I/O Burst Cycle

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

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

CS370 Operating Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Frequently asked questions from the previous class survey

Comp 310 Computer Systems and Organization

CHAPTER 2: PROCESS MANAGEMENT

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

Chapter 6: CPU Scheduling

LECTURE 3:CPU SCHEDULING

CS307: Operating Systems

Example: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps

Operating System Review Part

CSL373: Lecture 6 CPU Scheduling

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

CSCE Operating Systems Scheduling. Qiang Zeng, Ph.D. Fall 2018

Interactive Scheduling

Two Level Scheduling. Interactive Scheduling. Our Earlier Example. Round Robin Scheduling. Round Robin Schedule. Round Robin Schedule

Lecture 2 Process Management

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

CSE 120 Principles of Operating Systems

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

Operating Systems. Process scheduling. Thomas Ropars.

CS370 Operating Systems

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

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

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

CS 326: Operating Systems. CPU Scheduling. Lecture 6

SMD149 - Operating Systems

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)

Chapter 5 CPU scheduling

Scheduling Mar. 19, 2018

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

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

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

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

Job Scheduling. CS170 Fall 2018

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

Scheduling. Scheduling 1/51

Start of Lecture: February 10, Chapter 6: Scheduling

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

Transcription:

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

CPU Scheduling Manage CPU to achieve several objectives: maximize CPU utilization minimize response time maximize throughput minimize turnaround time Multiprogrammed OS multiple processes in executable state at same time scheduling picks the one that will run at any give time (on a uniprocessor) Processes use the CPU in bursts may be short or long depending on the job 2

Types of Scheduling At least 4 types: long-term - add to pool of processes to be executed medium-term - add to number of processes partially or fully in main memory short-term - which available process will be executed by the processor I/O - which process s pending I/O request will be handled by an available I/O device Scheduling changes the state of a process 3

Scheduling criteria Per processor, or system oriented CPU utilization maximize, to keep as busy as possible throughput maximize, number of processes completed per time unit Per process, or user oriented turnaround time minimize, time of submission to time of completion. waiting time minimize, time spent in ready queue - affected solely by scheduling policy response time minimize, time to produce first output most important for interactive OS 4

Scheduling criteria non-performance related Per process predictability job should run in about the same amount of time, regardless of total system load Per processor fairness don t starve any processes, treat them all the same enforce priorities favor higher priority processes balance resources keep all resources busy 5

Medium vs. Short Term Scheduling Medium-term scheduling Part of swapping function between main memory and disk based on how many processes the OS wants available at any one time must consider memory management if no virtual memory (VM), so look at memory requirements of swapped out processes Short-term scheduling (dispatcher) Executes most frequently, to decide which process to execute next Invoked whenever event occurs that interrupts current process or provides an opportunity to preempt current one in favor of another Events: clock interrupt, I/O interrupt, OS call, signal 6

Long-term scheduling Determine which programs admitted to system for processing - controls degree of multiprogramming Once admitted, program becomes a process, either: added to queue for short-term scheduler swapped out (to disk), so added to queue for medium-term scheduler Batch Jobs Can system take a new process? more processes implies less time for each existing one add job(s) when a process terminates, or if percentage of processor idle time is greater than some threshold Which job to turn into a process first-come, first-serve (FCFS), or to manage overall system performance (e.g. based on priority, expected execution time, I/O requirements, etc.) 7

Process State Transitions New Long-term scheduling Ready, suspend Blocked, suspend Mediumterm scheduling Ready Blocked Shortterm scheduling Event wait Running Exit 8

Process Priority Use multiple run queues, one for each priority Who decides priority dispatcher - that mixes policy and mechanism too much when the process is created, assign it a priority have a second level scheduler (often called medium term scheduler) to manage priorities mechanism is to move processes between different queues Will discuss scheduling more in a future lecture 9

Short-term scheduling algorithms First-Come, First-Served (FCFS, or FIFO) as process becomes ready, join Ready queue, scheduler always selects process that has been in queue longest better for long processes than short ones favors CPU-bound over I/O-bound processes need priorities, on uniprocessor, to make it effective 10

Algorithms (cont.) Round-Robin (RR) use preemption, based on clock - time slicing generate interrupt at periodic intervals when interrupt occurs, place running process in Ready queue, select next process to run using FCFS what s the length of a time slice short means short processes move through quickly, but high overhead to deal with clock interrupts and scheduling guideline is time slice should be slightly greater than time of typical job CPU burst problem dealing with CPU and I/O bound processes 11

Algorithms (cont.) Shortest Process Next (SPN) non-preemptive select process with shortest expected processing time improves response time, but increases its variability, reducing predictability - provably decreases average waiting time problem is estimating required processing time risk of starving longer processes, as long as there are shorter processes around not good for time sharing - non-preemptive 12

Algorithms (cont.) Shortest Remaining Time (SRT) preemptive version of SPN scheduler chooses process with shortest expected remaining process time still need estimate of processing time, and can starve longer processes no bias in favor of longer processes, as in FCFS no extra interrupts as in RR, so reduced overhead must record elapsed service times should give better turnaround time than SPN 13

Priorities Priority Based Scheduling assign each process a priority, and scheduler always chooses process of higher priority over one of lower priority More than one ready queue, ordered by priorities RQ0 RQ1 Dispatch CPU Release Admit. RQn Event Occurs Blocked queue Preemption Event Wait 14

Priority Algorithms Fixed Queues processes are statically assigned to a queue sample queues: system, foreground, background Multilevel Feedback processes are dynamically assigned to queues penalize jobs that have been running longer preemptive, with dynamic priority have N ready queues (RQ0-RQN), start process in RQ0 if quantum expires, moved to i + 1 queue 15

Feedback scheduling (cont.) problem: turnaround time for longer processes can increase greatly, even starve them, if new short jobs regularly enter system solution1: vary preemption times according to queue processes in lower priority queues have longer time slices solution2: promote a process to higher priority queue after it spends a certain amount of time waiting for service in its current queue, it moves up solution3: allocate fixed share of CPU time to jobs if a process doesn t use its share, give it to other processes variation on this idea: lottery scheduling assign a process tickets (# of tickets is share) pick random number and run the process with the winning ticket. 16

UNIX System V Multilevel feedback, with RR within each priority queue 10ms second preemption priority based on process type and execution history, lower value is higher priority priority recomputed once per second, and scheduler selects new process to run For process j, P(i) = Base + CPU(i-1)/2 + nice P(i) is priority of process j at interval i Base is base priority of process j CPU(i) = U(i)/2 + CPU(i-1)/2 U(i) is CPU use of process j in interval i exponentially weighted average CPU use of process j through interval i nice is user-controllable adjustment factor 17

UNIX (cont.) Base priority divides all processes into (nonoverlapping) fixed bands of decreasing priority levels swapper, block I/O device control, file manipulation, character I/O device control, user processes bands optimize access to block devices (disk), allow OS to respond quickly to system calls penalizes CPU-bound processes w.r.t. I/O bound targets general-purpose time sharing environment 18

Windows NT Target: single user, in highly interactive environment a server preemptive scheduler with multiple priority levels flexible system of priorities, RR within each, plus dynamic variation on basis of current thread activity for some levels 2 priority bands, real-time and variable, each with 16 levels real-time ones have higher priority, since require immediate attention(e.g. communication, real-time task) 19

Windows NT (cont.) In real-time class, all threads have fixed priority that never changes In variable class, priority begins at an initial value, and can change, up or down FIFO queue at each level, but thread can switch queues Dynamic priority for a thread can be from 2 to 15 if thread interrupted because time slice is up, priority lowered if interrupted to wait on I/O event, priority raised favors I/O-bound over CPU-bound threads for I/O bound threads, priority raised more for interactive waits (e.g. keyboard, display) than for other I/O (e.g. disk) 20

Multi-Processor Scheduling Multiple processes need to be scheduled together Called gang-scheduling Allowing communicating processes to interact w/o/ waiting Try to schedule processes back to same processor Called affinity scheduling Maintain a small ready queue per processor Go to global queue if nothing local is ready 21