Process Scheduling Schedulers and Scheduling Methods.

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Advertisements

Operating Systems1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers 5.2 Scheduling Methods – A Framework.
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.
Scheduling Algorithms
Chapter 3: CPU Scheduling
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
02/06/2008CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
Scheduling in Batch Systems
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
Chapter 5-CPU Scheduling
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
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.
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.
CS3530 OPERATING SYSTEMS Summer 2014 Processor Scheduling Chapter 5.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Chapter 6 CPU SCHEDULING.
More Scheduling cs550 Operating Systems David Monismith.
Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution.
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.
3.1 : Resource Management Part2 :Processor Management.
ICS Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling Methods.
CompSci 143A1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
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.
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.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Purpose of Operating System Part 2 Monil Adhikari.
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.
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.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Dan C. Marinescu Office: HEC 439 B. Office hours: M, Wd 3 – 4:30 PM.
Chapter 5a: CPU Scheduling
Networks and Operating Systems: Exercise Session 2
CPU Scheduling.
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Introduction What is an operating system bootstrap
Operating System Concepts
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling.
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Presentation transcript:

Process Scheduling Schedulers and Scheduling Methods

Processes and CPU utilization Processes often need to be suspended Reason for suspension may include Lack of resources Waiting for signals I/O operations Kernel operations Page Fault (later more) Whatever the reason, the OS must suspend the process and allow another to utilize the CPU

The framework Two strategies: Preemptive Scheduling Non-Preemptive Scheduling Scheduling decisions must be made in any of the following situation: Process switches from running to waiting state; Process switches from running to ready state Process switches from waiting to ready state When a process terminates

CPU Burst Time Time, T b that a process could run without needing to be put into a waiting queue. We can think of program as a series of CPU- Bursts and I/O Bursts, interspersed. Alternatively, CPU Burst is the time that a process could stay in the CPU before the next interrupt IF we were running a non-preemptive scheduler

Priority Scheduling All schedulers use some sort of process priority level to decide which process will execute next. Priority P of process p i can be viewed as a function P = prio(p i ), where the function prio() may by as simple as retrieving the process’ user assigned priority or as complex as necessary to take runtime conditions of the system into consideration. In general, priority can be static  no change during the runtime of the process; dynamic  it may change do to the dynamic nature of the system of processes in the system; In case of dynamic priority, the scheduler may re-calculate the priority of each process whenever it executes. Regardless of how the priorities are computed, they divide the set of processes into multiple priority levels (or classes) These levels are manifested in a data structure called Ready List (RL). We may think of a priority list (queues), i.e., a list of list such that the priority of processes on list RL[i] have precedence of processes on list RL[j] if j < i.

Priority Functions The decision which process will be allowed to execute is generally based on some measure of priority p. System measures that may determine the priority level of a process include: attained service time real-time in the system total service time deadline periodicity external priority memory requirements Many of these parameters are dynamic in nature and will cause the priority of a process to change over time. External priorities may be assigned to processes to indicate an initial difference among processes. A function that combines external (statically assigned) priorities with dynamic priority measures will determine the outcome of a scheduling decision Arbitration becomes necessary when two processes with equal priority are to be scheduled. This is the function of the arbitration rule! In a quantum-based system, the arbitration rule may be “round-robin”. In most other systems (e.g.,FIFO), chronological ordering is used.

Scheduling Methods We can categorize the various scheduling methods by: PF  Priority Function DM  Decision Mode AR  Arbitration Rule FIFO SJF SRT RR First In / First Out (FIFO): Processes that arrive earlier have higher priority. PF  P = r, where r is the amount of real-time that the process has spent in the system. DM  Non-Preemtive AR  random choice among processes arriving at exactly the same time

… methods cont’d Shortest Job First (SJF): Processes with lower total service time have priority! PF  P = -t, where t is the total service time DM  Non-Preemptive AR  either chronological or random among processes with same service time. SJF is provably optimal, in that it results in the minimum average waiting time for a given set of processes!! Example: Consider the following set of processes ProcessBurst Time P 1 6 P 2 8 P 3 7 P 4 3 Calculate the average waiting time when FIFO is used ( order) and compare with the avg. waiting time for SJF.

SJF optimality … The average waiting time for FIFO scheduling is computed as: (P 1 (0) + P 2 (6) + P 3 (14) + P 4 (21)) / 4 = time units. The average waiting time for SJF is computed as: (P 4 (0) + P 1 (3) + P 3 (9) + P 2 (16)) / 4 = 7 time units. We need to prove that this is true in general. How do we do that? Hint: Consider how we calculate the average waiting time of a sequence of processes with corresponding burst time t bi. awt = 1/n Σ i=1 (n-i) x t bi We clearly would like the largest burst time to occur in the sum as the n th element  with weight 0.

…methods cont’d SJF is Non-Preemptive! We can show optimality of SJF on a static set of processes. However, if we consider arbitrary arrival times of processes, we must re-define SJF to allow for the preemption of already executing processes. This yields a new version of SJF, sometimes referred to as Shortest Remaining Time First (SRT). Shortest Remaining Time (SRT): A preemptive and dynamic version of SJF giving processes with the least amount of remaining time to complete the highest priority. PF  P = (t – a), where t-a is the remaining time; DM  preemptive; AR  Same as SJF – chronological or random among processes with the same time to completion.

More Scheduling Methods Round Robin (RR): Round Robin imposes a fixed time quantum (time slice) on the amount of continuous CPU time that can be used by a process. When the time slice expires, the process is preempted and place on the ready-list. PF  P = 0; all processes have the same priority; DM  preemptive quantum oriented AR  cyclic; Multilevel Priority (ML): Uses a fixed set of priorities 1 (lowest) thru n (highest). Each process is assigned an external priority e upon creation. This priority can only be changed by authorized kernel calls. PF  P = e; DM  preemptive if newly arriving process has a higher priority. Within each priority queue, scheduling may be preemptive RR or non-preemptive FIFO. AR  cyclic if RR, random/chronological if FIFO.

Example of RR with Time Quantum = 20 ProcessBurst Time P 1 53 P 2 17 P 3 68 P 4 24 The Gantt chart is: Typically, higher average turnaround than SJF, but better response P1P1 P2P2 P3P3 P4P4 P1P1 P3P3 P4P4 P1P1 P3P3 P3P

The Relationship Between Priorities and Time- slice length

Summary of Scheduling Methods AlgorithmDecision ModePriority FunctionArbitration Rule FIFOnonpreemptiver random SJFnonpreemptive -t-t chronological or random SRTpreemptive- (t-a) chronological or random RRpreemptiveO cyclic RMpreemptive-d chronological or random EDFpreemptive- (d-r%d) chronological or random a = attained service time r = real time in system t = total service time d = period e = external priority