CS444/CS544 Operating Systems Scheduling 1/31/2007 Prof. Searleman

Slides:



Advertisements
Similar presentations
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Advertisements

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.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Chapter 3: CPU Scheduling
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
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.
CS444/CS544 Operating Systems Scheduling 2/05/2007 Prof. Searleman
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CS444/CS544 Operating Systems CPU Scheduling 2/07/2006 Prof. Searleman
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
Chapter 5-CPU Scheduling
Job scheduling Queue discipline.
A. Frank - P. Weisberg Operating Systems CPU Scheduling.
7/12/2015Page 1 Process Scheduling B.Ramamurthy. 7/12/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: Process Scheduling
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Basic Concepts Maximum CPU utilization.
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.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Chapter 6 CPU SCHEDULING.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Chapter 5 CPU Scheduling Bernard Chen Spring 2007.
Process A program in execution. But, What does it mean to be “in execution”?
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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
Chapter 5 Processor Scheduling Introduction Processor (CPU) scheduling is the sharing of the processor(s) among the processes in the ready queue.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
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.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 5: CPU Scheduling Basic.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Introduction to Operating System Created by : Zahid Javed CPU Scheduling Fifth Lecture.
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.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Operating System Concepts
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling: Basic Concepts
Chapter 5: CPU Scheduling
Presentation transcript:

CS444/CS544 Operating Systems Scheduling 1/31/2007 Prof. Searleman

CS444/CS544 Spring 2007 CPU Scheduling Reading assignment: Chapter 5 HW#3: done in lab HW#4HW#4 posted, due: Help for Lab1, 6-7 pm tonight in ITL/COSI

Benefits of Concurrency Hide latency of blocking I/O without additional complexity Without concurrency Block whole process Manage complexity of asynchronous I/O (periodically checking to see if it is done so can finish processing) Ability to use multiple processors to accomplish the task Servers often use concurrency to work on multiple requests in parallel User Interfaces often designed to allow interface to be responsive to user input while servicing long operations

Scheduling CPU or “short term” scheduler selects process from ready queue (every 10 msec or so) “dispatcher” does the process switching “long-term” scheduler controls “degree of multiprogramming” (number of processes in memory); selects a good “job mix” “job mix” – I/O-bound, CPU-bound, interactive, batch, high priority, background vs. foreground, real-time “non-preemptive” (cooperative) vs. “preemptive”

Performance Measures Throughput: #processes/time unit Turnaround time: time completed – time submitted Waiting time: sum of times spent in ready queue Response time: time from submission of a request until the first response is produced Variation of response time (predictability) CPU utilization Disk (or other I/O device) utilization

I/O-bound & CPU-bound Device1 P1 CPU P2 CPU Device2 time quantum

I/O-bound & CPU-bound P1: CPU-bound Device1 idle CPU idle Device1 idle Turnaround time for P1

I/O-bound & CPU-bound P2: I/O-bound Device2 idle CPU idle Device2 idle Turnaround time for P2

I/O-bound & CPU-bound Schedule1: non-preemptive, P1 selected first Turnaround time for P2 Turnaround time for P1 Without P1

I/O-bound & CPU-bound Schedule2: non-preemptive, P2 selected first Turnaround time for P2 Turnaround time for P1

I/O-bound & CPU-bound How does the OS know whether a process is I/O-bound or CPU-bound? - can monitor the behavior of a process & save the info in the PCB - example: how much CPU time did the process use in its recent time quanta? (a small fraction => I/O intensive; all of the quantum => CPU intensive) The nature of a typical process changes from I/O- bound to CPU-bound and back as it works through its Input/Process/Output Cycle

Preemptive vs. Non-Preemptive t 0 ready: P1, P2 t 1 ready: P2 blocked: P1 t2t2

Preemptive vs. Non-Preemptive t 3 ready: P2 running: P1 t 2 ready: P1 blocked: P2 Non-Preemptive: must continue to run P1 at t 3 Preemptive: can choose between P1 & P2 at t 3

New Ready Running Waiting Terminated admit dispatch (4) exit, abort (2) interrupt (1) block for I/O or wait for event (3) I/O completed or event occurs nonpreemptive (cooperative): (1) and (4) only preemptive: otherwise

First Come First Serve (FCFS) Also called First In First Out (FIFO) Jobs scheduled in the order they arrive When used, tends to be non-preemptive If you get there first, you get all the resource until you are done “Done” can mean end of CPU burst or completion of job Sounds fair All jobs treated equally No starvation (except for infinite loops that prevent completion of a job)

FCFS average waiting time = ( )/3 = 12.6 P1P1 18 P2P2 20 P3P3 24 ProcessCPU burst P1P1 18 P2P2 2 P3P3 4 Gantt chart 0 P1, P2, P3 ready

Problems with FCFS/FIFO Can lead to poor overlap of I/O and CPU If let first in line run till they are done or block for I/O then can get convoy effect While job with long CPU burst executes, other jobs complete their I/O and the I/O devices sit idle even though they are the “bottleneck” resource and should be kept as busy as possible Also, small jobs wait behind long running jobs (even grocery stores know that) Results in high average turn-around time

Shortest Job First (SJF) So if we don’t want short running jobs waiting behind long running jobs, why don’t we let the job with the shortest CPU burst go next Can prove that this results in the minimum (optimal) average waiting time Can be preemptive or non-preemptive Preemptive version called shortest-remaining-time first (SRTF)

SJF average waiting time = ( )/3 = 2.6 P1P1 24 P2P2 2 P3P3 6 ProcessCPU burst P1P1 18 P2P2 2 P3P3 4 Gantt chart 0 P1, P2, P3 ready

SJF average waiting time = ( )/4 = 4 P1P1 7 P2P2 12 P3P3 8 0 P 1 ready ProcessArrival time CPU burst P1P1 07 P2P2 24 P3P3 41 P4P4 54 P4P4 16 nonpreemptive 2 P 1 running P 2 ready 4 P 1 running P 2, P 3 ready 5 P 1 running P 2, P 3, P 4 ready

SRTF average waiting time = ( )/4 = 3 P1P1 P3P3 0 P 1 ready ProcessArrival time CPU burst P1P1 07 P2P2 24 P3P3 41 P4P4 54 P4P4 11 preemptive 2 P 1 running P 2 ready 4 P 2 running P 1, P 3 ready 5 P 3 completes P 1, P 2, P 4 ready P2P2 P2P2 16 P1P1 7 P 1, P 4 ready P 1 ready

SRTF average waiting time = ( )/4 = 3 average turnaround time = ( )/4 P1P1 P3P3 0 Processturnaround Time waiting Time P1P1 P2P2 P3P3 P4P4 P4P P2P2 P2P2 16 P1P – 0 = 16 7 – 2 = – 4 = 1 11 – 5 = preemptive

Problems with SJF First, how do you know which job will have the shortest CPU burst or shortest running time? Can guess based on history but not guaranteed Bigger problem is that it can lead to starvation for long-running jobs If you never got to the head of the grocery queue because someone with a few items was always cutting in front of you