Scheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher

Similar documents
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)

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Scheduling of processes

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

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

Chapter 5 CPU scheduling

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

8: Scheduling. Scheduling. Mark Handley

SMD149 - Operating Systems

Scheduling in the Supermarket

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling

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

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

Chapter 6: CPU Scheduling

CS370 Operating Systems

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

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.

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

Uniprocessor Scheduling. Aim of Scheduling

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

Properties of Processes

Chapter 6: CPU Scheduling

CHAPTER 2: PROCESS MANAGEMENT

Practice Exercises 305

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

Chapter 9. Uniprocessor Scheduling

Chapter 5: CPU Scheduling

by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science

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

Chapter 5 Process Scheduling

Operating Systems CS 323 Ms. Ines Abbes

CPU Scheduling Algorithms

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

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

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

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

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

CPU Scheduling: Objectives

Course Syllabus. Operating Systems

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

Last Class: Processes

CS370 Operating Systems

Scheduling. The Basics

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

Scheduling. Today. Next Time Process interaction & communication

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

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

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

CS370 Operating Systems

Ch 4 : CPU scheduling

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating System Concepts Ch. 5: Scheduling

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

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

Operating system concepts. Task scheduling

CSE 4/521 Introduction to Operating Systems

Uniprocessor Scheduling. Chapter 9

CS Computer Systems. Lecture 6: Process Scheduling

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

Computer Science 4500 Operating Systems

Chapter 19: Real-Time Systems. Operating System Concepts 8 th Edition,

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

Operating Systems ECE344. Ding Yuan

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones

CS307: Operating Systems

COSC243 Part 2: Operating Systems

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

LECTURE 3:CPU SCHEDULING

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

Chapter 9 Uniprocessor Scheduling

CS370 Operating Systems

Chapter 5: Process Scheduling

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

Frequently asked questions from the previous class survey

Interactive Scheduling

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

Job Scheduling. CS170 Fall 2018

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

Unit 3 : Process Management

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

Chapter 5: Process Scheduling

Process management. Scheduling

Chapter 5 Scheduling

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010

Chapter 6: CPU Scheduling

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

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

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

Computer Systems Laboratory Sungkyunkwan University

Chapter 6: CPU Scheduling

8th Slide Set Operating Systems

Process Scheduling. Copyright : University of Illinois CS 241 Staff

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

Operating Systems Unit 3

Process- Concept &Process Scheduling OPERATING SYSTEMS

Chapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on

Transcription:

CSC400 - Operating Systems 7: Scheduling J. Sumey Scheduling one of the main tasks of an OS the scheduler / dispatcher concerned with deciding which runnable process/thread should get the CPU next occurs on any timesharing system and PCs where multiple processes compete concurrently for the CPU scheduling policy: the method by which this decision is made CSC400 - Scheduling 2 CSC400 Operating Systems 1

Scheduling Implementations nonpreemptive once given a CPU, a process runs to completion (no revoke) easy, but questionable fairness in-order processing, but no priorities vulnerable to errant programs preemptive OS can revoke CPU from a running process at quantum expiration additional cost of context switches and memory demands useful in real-time or interactive systems CSC400 - Scheduling 3 Priorities are assigned to each process to indicate relative importance of the process may influence selection decisions by scheduler types: static (fixed) easy to implement, nonresponsive to changes dynamic more complex but can respond to changes to increase throughput or decrease latencies CSC400 - Scheduling 4 CSC400 Operating Systems 2

Scheduling Objectives scheduler needs are affected by type of system, but may be required to: 1. maximize throughput number of completed processes per unit of time 2. minimize response time for interactive processes 3. maximize resource utilization (CPU, memory) 4. avoid indefinite postponement 5. enforce priorities 6. minimize overhead of scheduler/os 7. ensure predictability of system service some objectives contradict each other! CSC400 - Scheduling 5 Scheduling Criteria priorities should favor jobs with higher priorities process behavior CPU-bound: tends to use entire quantum I/O-bound: tends towards brief CPU usage before I/O request response requirements interactive: needs good response (ex: GUI) batch: can suffer reasonable delays real-time: requires precise response CSC400 - Scheduling 6 CSC400 Operating Systems 3

Scheduling Algorithms Non-preemptive FIFO/FCFS: First-Come-First-Served SJF/SRT: Shortest Job First HRRN: Highest Response Ratio Next Preemptive RR: Round-Robin lottery multilevel queues real-time CSC400 - Scheduling 7 First-Come-First-Served FCFS, a.k.a. FIFO, dispatches jobs according to their arrival time is nonpreemptive fairness all jobs treated equally unfairness long jobs force short jobs to wait, unbounded simple to implement, but rarely used in modern OSs as primary policy CSC400 - Scheduling 8 CSC400 Operating Systems 4

Shortest-Job-First SJF is similar to FIFO, but chooses waiting job with shortest (estimated) remaining runtime, aka SRT favors shorter-running jobs at expense of longer jobs; thus reducing number of waiting jobs & average wait time con: requires runtime estimates, difficult to provide accurate values may require use of a "penalty" mechanism CSC400 - Scheduling 9 Highest-Response-Ratio-Next uses estimated runtime (e.r.t.) like SJF but reduces bias against long jobs HRRN assigns dynamic priorities to jobs based on e.r.t. and wait time wait_time e.r.t. priority e.r.t. eliminates indefinite postponement CSC400 - Scheduling 10 CSC400 Operating Systems 5

Round-Robin RR dispatches jobs FIFO, but only gives CPU for a fixed time slice/quantum preemption causes job to be moved to end of the ready queue con: assumes equal priority for all jobs efficiency consideration: choice of quantum duration vs. context switch time ex: Linux uses 100ms, XP uses 20ms (but variable) CSC400 - Scheduling 11 Lottery Scheduling jobs are given lottery tickets for system resources, including CPU scheduler chooses a random ticket and grants access to "winner" easily accommodates different priorities via number of tickets highly responsive and automatically fair based on statistical probabilities CSC400 - Scheduling 12 CSC400 Operating Systems 6

Multilevel Queues adaptive scheme that caters to changing job behaviors based on whether or not job uses full quantum (CPU- vs. IO-bound) use FIFO queues for all levels except lowest, which uses RR scheduler chooses job at head of highest nonempty level new jobs have higher priority at least for a while CSC400 - Scheduling 13 Real-time Scheduling adds requirement of guaranteeing reaction to external stimuli within fixed amount of time to ensure timing constraints are met real-time system events may be: periodic (regular intervals) ex: RPM sensor aperiodic/asynchronous (unpredictable) ex: emergency stop button CSC400 - Scheduling 14 CSC400 Operating Systems 7

Real-time Scheduling - 2 RT scheduling models: hard RT - absolute deadlines always met soft RT - missing occasional deadlines tolerable RT systems must be schedulable given m periodic events each with a period of P i requiring C i CPU time, m Ci system is schedulable only if: 1 i 1 Pi does not account for context switches & nonperiodic events CSC400 - Scheduling 15 Real-time Scheduling - 3 RT scheduling algorithms rate-monotonic: favors periodic processes via higher priorities earliest-deadline-first: dispatches processes according to nearest deadline least-laxity: processes chosen based on smallest "elbow room" (laxity) formula: L = D (T+C) D=deadline T=current time C=remaining CPU time CSC400 - Scheduling 16 CSC400 Operating Systems 8

Scheduling Support in pthreads POSIX threads includes various support routines to affect policies, priorities, etc. pthread_attr_getschedpolicy() pthread_attr_setschedpolicy() get/set scheduling policy to SCHED_FIFO, SCHED_RR, or SCHED_OTHER pthread_attr_getschedparam() pthread_attr_setschedparam() allows caller to get/set priority of calling thread CSC400 - Scheduling 17 Thread Scheduling in Java Java's virtual machine provides multithreading to every applet or app. apps are derived from class Thread uses multilevel queues based on priorities from 1 (min) to 10 (max) with RR policy within each queue threads run to completion, quantum expiration, or till calling yield() method CSC400 - Scheduling 18 CSC400 Operating Systems 9

Thread Scheduling in Windows XP's dispatcher performs preemptive scheduling of each thread doesn't care about owning process! uses 32 ready queues based on priority 31-16 for real-time threads 15-0 for dynamic (non RT) threads RR policy within each level supports SMP (symmetric multiprocessing) dispatches threads to mult. physical or virtual CPUs ex: Pentium HT/Core2Duo/QuadCore technologies CSC400 - Scheduling 19 CSC400 Operating Systems 10