1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.

Slides:



Advertisements
Similar presentations
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

1 Uniprocessor Scheduling Types of scheduling –The aim of processor scheduling is to assign processes to be executed by the processor so as to optimize.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
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.
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 19 Scheduling IV.
Operating Systems Chapter 6
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Ceng Operating Systems Chapter 2.2 : Process Scheduling Process concept  Process scheduling Interprocess communication Deadlocks Threads.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
Chapter 3: CPU Scheduling
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
1 Uniprocessor Scheduling Module CPU Scheduling n We concentrate on the problem of scheduling the usage of a single processor among all the existing.
Chapter 5-CPU Scheduling
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.
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
1 Scheduling Algorithms FCFS First-Come, First-Served Round-robin SJF Multilevel Feedback Queues.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
CSE 331 Operating Systems Design 1 Scheduling Scheduling is divided into various levels. These levels are defined by the location of the processes A process.
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.
10CSE CPU Scheduling Copyrights Lecture Slides adapted from “ Advanced Operating Systems ”, Lecture Notes by Prof. Prof. Daniel Mosse, University Of Pittsburgh,
1 Uniprocessor Scheduling Chapter 9. 2 CPU Scheduling We concentrate on the problem of scheduling the usage of a single processor among all the existing.
Chapter 6 CPU SCHEDULING.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Operating System Chapter 9. Uniprocessor Scheduling
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
1 Uniprocessor Scheduling Chapter 9. 2 CPU Scheduling n We concentrate on the problem of scheduling the usage of a single processor among all the existing.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Operating System 9 UNIPROCESSOR SCHEDULING. TYPES OF PROCESSOR SCHEDULING.
Uniprocessor Scheduling Chapter 9. Processor Scheduling Processor scheduling determines the assignment of processes to be executed by the processor over.
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.
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.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
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.
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
CPU Scheduling CS Introduction to Operating Systems.
CPU Scheduling G.Anuradha Reference : Galvin. CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time.
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.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU 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.
CPU Scheduling Andy Wang Operating Systems COP 4610 / CGS 5765.
CPU SCHEDULING.
Chapter 5a: CPU Scheduling
CPU Scheduling Chapter 5.
Chapter 2.2 : Process Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Uniprocessor Scheduling
Operating System Concepts
CPU Scheduling: Basic Concepts
Presentation transcript:

1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting times Minimize response time Minimize turnaround time

2 Two Components of Scheduling Policies Selection function  which process in the ready queue is selected next for execution? Decision mode  at what times is the selection function exercised? Nonpreemptive  A process in the running state runs until it blocks or ends Preemptive  Currently running process may be interrupted and moved to the Ready state by the OS  Prevents any one process from monopolizing the CPU

3 A running example to discuss various scheduling policies Process Arrival Time Burst Time

4 First Come First Served (FCFS)  Selection function: the process that has been waiting the longest in the ready queue (hence, FCFS, FIFO queue)  Decision mode: nonpreemptive a process runs until it blocks itself (I/O or other)  Drawbacks: favours CPU-bound processes

5 Shortest Job First (SJF)  Selection function: the process with the shortest expected CPU burst time  Decision mode: non-preemptive  I/O bound processes will be picked first  Estimate the expected CPU burst time for each process: on the basis of past behavior.  Drawback: Longer processes can starve if steady supply of I/O bound jobs Shortest job First (SJF)

6 Shortest Remaining Time (SRT) = Preemptive SJF  If a process arrives in the Ready queue with estimated CPU burst less than remaining time of the currently running process, preempt.  Prevents long jobs from dominating. But must keep track of remaining burst times  Better turnaround time than SJF Short jobs get immediate preference P1P2P3P5P2P

7  Selection function: same as FCFS  Decision mode: Preemptive Maximum time slice enforced by timer interrupt Running process is put at tail of ready queue Round-Robin

8 Time Quantum for Round Robin  must be substantially larger than process switch time  should be larger than the typical CPU burst  If too large, degenerates to FCFS  Too small, excessive context switches (overhead)

9 Round Robin: Critique  Still favors CPU-bound processes An I/O bound process uses the CPU for a time less than the time quantum and then is blocked waiting for I/O A CPU-bound process runs for its whole time slice and goes back into the ready queue (in front of the blocked processes)  One solution: virtual round robin (VRR, not in book…) When a I/O has completed, the blocked process is moved to an auxiliary queue which gets preference over the main ready queue A process dispatched from the auxiliary queue gets a shorter time quantum (what is “left over” from its quantum when it was last selected from the ready queue)

10 Priority Queues Scheduler chooses from low priority queue only if higher ones are empty Hi priority Low priority

11 Multilevel Feedback Queues  Several READY queues with decreasing priorities: P(RQ0) > P(RQ1) >... > P(RQn) But lower priority queues get longer time slice  New processes are placed in RQ0  If they use their time quantum, they are placed in RQ1. If they time out again, they go to RQ2, etc. until they reach lowest priority  Automatically reduces priority of CPU-bound jobs, leaving I/O-bound ones at top priority  Dispatcher always chooses a process from highest non-empty queue  Problem: long jobs can “starve” Solution: “aging” (promote priority of a process that waits too long in a lower priority queue)

12 Multilevel Feedback Queues  Note: many variations of policies possible including different policies at different levels.. RR, Q=1 RR, Q=2... Q=4 etc. FCFS

13 Multilevel Feedback Scheduling  Multilevel feedback scheduling is the most flexible method  can customize: Number of queues Scheduling algorithm per queue Priority “upgrade” criteria Priority “demotion” criteria Policy to determine which queue a process starts in

14 Algorithm Comparison  Which one is best?  It depends: on the system workload (extremely variable) hardware support for the dispatcher relative weighting of performance criteria (response time, CPU utilization, throughput...) The evaluation method used Management priorities  machine efficiency vs. user service..

15 Let’s do some examples..  Work out schedules for: FCFS RR(Q=1) RR(Q=4) SJF SRT  Compute: T r (response time) T w (wait time)  For each process, and  Average for all 5

16 Some Useful Relationships T a : Arrival Time T s : Service Time (CPU burst) T f : Finish time T w : Wait time T r = T f - T a (response time) Note that:  T f = T a + T s + T w, or  T f - T a = T s + T w = T r  Therefore: T w = T r - T s We start by working out the finish time

17 Example to evaluate various scheduling policies Process Arrival Time Burst Time

18 Summary Results