ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.

Slides:



Advertisements
Similar presentations
Operating Systems Process Scheduling (Ch 3.2, )
Advertisements

CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
A. Frank - P. Weisberg Operating Systems Advanced CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CPU Scheduling Section 2.5.
Chapter 3: CPU Scheduling
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
© Ibrahim Korpeoglu Bilkent University
Scheduling in Batch Systems
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Operating Systems (CSCI2413) Lecture 4 Process Scheduling phones off (please)
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
1 Uniprocessor Scheduling Chapter 9. 2 Aims of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Job scheduling Queue discipline.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Main Job: Assign processes to be executed by the processor(s) and processes to be loaded in main.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU-Scheduling Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The short term scheduler.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Chapter 4 Processor Management
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Chapter 6 CPU SCHEDULING.
Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
1 CSE451 Scheduling Autumn 2002 Gary Kimura Lecture #6 October 11, 2002.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Uniprocessor Scheduling
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
CSC 322 Operating Systems Concepts Lecture - 10: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS333 Intro to Operating Systems Jonathan Walpole.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Scheduling.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Chapter 2 Scheduling.
Chapter 6: CPU Scheduling
Andy Wang Operating Systems COP 4610 / CGS 5765
Presentation transcript:

ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling

Agenda Scheduling Batch Interactive Real-Time Threads

Scheduling: When New Process is Created Parent Process Child Process Process Exits When a process blocks I/O Interrupt occurs Clock Interrupts Non-preemptive Preemptive

Objectives of a Good Scheduling Policy Fairness Efficiency Low response time (important for interactive jobs) Low turnaround time (important for batch jobs) High throughput

Scheduling Throughput The amount of useful work accomplished per unit time. This depends, of course, on what constitutes “useful work.” One common measure of throughput is jobs/minute (or second, or hour, depending on the kind of job) Utilization For each device, the utilization of a device is the fraction of time the device is busy. A good scheduling algorithm keeps all the devices (CPUs, disk drives, etc.) busy most of the time.

Scheduling Turnaround The length of time between when the job arrives in the system and when it finally finishes Response Time The length of time between when a job arrives in the system and when it starts to produce output. For interactive jobs, response time might be more important than turnaround. Wait Time The amount of time the job is ready (runnable but not running). This is a better measure of scheduling quality than turnaround since the scheduler has no control of the mount of time the process spends computing or blocked waiting for I/O.

Preemption Needs a clock interrupt (or equivalent) Needed to guarantee fairness Found in all modern general purpose operating systems Without preemption, the system implements “run to completion (or yield)”

Scheduling Algorithms (Batch) FIFO (First In First Out) Fairest Low throughput High Turnaround Shortest First High Throughput Low Turnaround Unfair for Large Jobs

Scheduling Algorithms (Batch, cont) Shortest Remaining High Turnaround on Long Jobs Unfair for Large Jobs Multi-Scheduling (CPU or Memory Limited) HIGH Turnaround (disk swaps) Throughput highly variable, probably low Fairness highly variable

First-Come First-Served The simplest possible scheduling discipline is called First-come, first- served (FCFS). The ready list is a simple queue (first-in/first-out). The scheduler simply runs the first job on the queue until it blocks, then it runs the new first job, and so on. When a job becomes ready it is simply added to the end of the queue.

FCFS Main advantage of FCFS is that it is easy to write and understand No starvation If one process gets into an infinite loop, it will run forever and shut out all the others FCFS tends to excessively favor long bursts. CPU-bound processes

Shortest Job First (SJF) Whenever the CPU has to choose a burst to run, it chooses the shortest one Non-preemptive policy Preemptive version of the SJN, called shortest remaining time first Starvation is possible

Scheduling Algorithms (Interactive) Round Robin Fairest overall Response time variable but finite Priority Scheduling Fair “More Fair” for users with higher priorities Response time inverse to priority

Round-Robin Round-robin (RR). RR keeps all the processes in a queue and runs the first one, like FCFS. After a length of time q (called quantum), if the current burst hasn’t completed, it is moved to the tail of the queue and the next process is started

Round Robin An important preemptive policy Essentially the preemptive version of FCFS The key parameter is the quantum size q When a process is put into the running state, a timer is set to q If the timer goes off and the process is still running, the OS preempts the process. The process is moved to the ready state The next job in the queue is selected to run

Round Robin Quantum can’t be too large Quantum can’t be too small What quantum should we choose Tradeoff Small q makes system more responsive Large q makes system more efficient since there’s less switching

Round Robin, Example

Priority Scheduling Always run the highest priority process Preemptive or non-preemptive Priorities can be assigned externally to processes based on their importance Assigned (and changed) dynamically

Other Interactive Scheduling Multiple Queues Shortest Process Next Guaranteed Scheduling Lottery Scheduling Fair-Share Scheduling

Scheduling Algorithms (Interactive, cont) Multi-Quantized Response time proportionate to quanta More bookkeeping Shortest Process Next Estimation of process length Unfair for large jobs Fast response for small jobs

Scheduling Algorithms (Interactive, cont) Guaranteed Scheduling Lottery Scheduling Alotted time proportional to Job Size/Importance Sharing Fair by user, not necessarily fair by job Responses become disproportionate

Scheduling Algorithms (Real-Time) Small Jobs High Priority Periodic/Aperiodic Schedulable? Iff the sum of the ratios CPU Time to Period time is less than one Sum(CPU/Period) <= 1 Static/Dynamic?

Scheduler Mechanism Some processes are intrinsically more important at some times than others Time-dependent response High-priority request How can a process raise it’s scheduling priority?

Thread Scheduling User-level threads Process has a Thread Scheduler Same concept as Process Scheduler Conflicts with Process Scheduling Kernel Level Threads Kernel has Thread and Process Scheduler Two Quanta’s Thread Quanta Process Quanta

Summary Scheduler responsible for many goals Scheduling algorithms complex Know your math!