1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.

Slides:



Advertisements
Similar presentations
CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
Advertisements

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
CPU SCHEDULING RONG ZHENG. OVERVIEW Why scheduling? Non-preemptive vs Preemptive policies FCFS, SJF, Round robin, multilevel queues with feedback, guaranteed.
Operating Systems Chapter 6
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Chapter 3: CPU Scheduling
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
Scheduling in Batch Systems
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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.
CPU Scheduling Introduction to Operating Systems: Module 13.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Chapter 6 CPU SCHEDULING.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Fair Resource Access & Allocation  OS Scheduling
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
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.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
CPU Scheduling Basic Concepts. Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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.
Operating Systems 1 K. Salah Module 2.2: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
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.
RTOS task scheduling models
ITFN 2601 Introduction to Operating Systems Lecture 4 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.
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.
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.
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.
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.
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Processor Scheduling Hank Levy 1.
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Scheduling 21 May 2019.
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Presentation transcript:

1 Real-Time Scheduling

2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling

3Scheduling Choosing which ready thread to run next Common criteria CPU Utilization –fraction of time is the CPU busy –Throughput – number of tasks are completed per unit time –Turnaround time – time delay from task first being submitted to OS to finally completing –Waiting time – amount of time a task spends in waiting queue Running Waiting Terminated Ready

4 Common Scheduling Algorithms First-Come, First Served (FCFS) –All queues operate as strict FIFOs without priority –Problems: large average delay, not preemptive Round Robin: add time-sharing to FCFS –At end of time tick, move currently running task to end of ready queue –Problems: Still have a large average delay, choosing time-tick is trade-off of context-switching overhead vs. responsiveness Shortest Job First (SJF) –Job = process –SJF is provably optimal in minimizing average waiting time –Problem: How do we determine how long the next job will take? Could predict it based on previous job?

5 Priority Scheduling Run the ready task with highest priority Define priority –Internal: Time limits, memory requirements –External: Importance to application, fees paid, department submitting task Problem: indefinite blocking (starvation) –Low level processes may never get to run in heavily loaded system –Two outcomes Processes run during winter break Processes disappear when computer eventually crashes

6 From OS to RTOS Traditional (non-real-time) Operating System –Hard to predict response time… –Hard to guarantee that a task will always run before its deadline Real-Time Operating System –Easy to determine that a task will always run before its deadline –Designed for periodic tasks What does Real-Time mean? Late answers are wrong answers! Real-Time means right now.

7 Scheduling – Selecting a Ready task to run Goals –Meet all task and ISR deadlines –Maximize processor utilization (U) U = Fraction of time CPU performs useful work Limit scheduling overhead (choosing what to run next) Limit context switching overhead Assigning priority based only on importance doesn’t work – why not? How do we assign priorities to task? –Statically – priority based on period (doesn’t change) –Dynamically – priority based on time left (changes)

8 Definitions for Task i Task execution time = T i Task execution period =  i : time between arrivals Utilization = fraction of time which CPU is used –For a task i –Overall, for all n tasks in the system Completion Time = time at which task finishes. This is also called turn-around time (for non-RT applications) or response time (for RT applications). Critical Instant = time at which task’s completion time is maximized. All tasks arrive simultaneously. Schedulable = a schedule exists which allows all tasks to meet their deadlines, even for the critical instant

9 Rate Monotonic Scheduling Assumptions –Tasks are periodic with period  i –Single CPU –T ContextSwitch = T scheduler = 0 –No data dependencies between tasks –Constant process execution time T i –Deadline = end of period =  i Assign priority based on period (rate) –Shorter period means higher priority

10 Processor Behavior – Graphical Analysis Time P1 P2 P3 P1 P2 P3 P1 P2 TaskExec. Time T Period  Priority P114High P226Medium P3312Low

11 Exact Schedulability Test for Task i Account for all processing at critical instant Consider possible additional task arrivals a n = nth estimate of time when task i completes Loop –Estimate higher priority job arrivals, compute completion time –Recompute based on any new arrivals Iterate until –a n >  i : not schedulable –a n+1 = a n <=  i : schedulable

12 Exact Schedulability Test for Example a 3 = a 4 < 12, so system is schedulable Iterate until a n-1 = a n

13 Utilization Bound Test for RMS Utilization U for n tasks –Fraction of time spent on tasks Maximum utilization U Max for m tasks –Max. value of U for which we can guarantee RMS works Utilization bound test –U < U Max : always schedulable with RMS –U Max < U < 1.0: inconclusive –U > 1.0: Not schedulable Why is U Max so small? (approaches ln(2)) Conservative

14 Example of Scheduling with RMS and UB TaskExec. Time T Period  Priority P114High P226Medium P3312Low > 0.780, so Utilization Bound Test is inconclusive

15 RMS Sometimes Fails Under 100% Utilization For some workloads with utilization below 100%, RMS priority allocation can fail Tasks P1, P2 have later deadlines than P3 yet preempt it due to their shorter periods ThreadExec. Time T Period  Priority P118High P219Medium P3912Low Time P1 P2 P3 Missed Deadline P1 P2 P3 P1 P2 Counter-example provided by C. Palenchar

16 Earliest Deadline First Can guarantee schedulability at up to 100% utilization Can’t use Exact Schedulability Test for EDF –Sum up all possible higher priority tasks, but priority depends on how close deadlines are! –Can we modify the test to deal with this? How does the kernel keep track of upcoming deadlines? –Can determine priority when inserting task into ready queue Need to search through queue to find correct location (based on deadline) –Can determine which task to select from ready queue Need to search through queue to find earliest deadline –Both are up to O(n) search time Can also do binary search tree

17 Earliest Deadline First Example ThreadExecution Time T Period  P114 P226 P Time P1 P2 P3 P1 P2 P3 P2 P1

18 System Performance During Transient Overload RMS – Each task has fixed priority. So? –This priority determines that tasks will be scheduled consistently Task A will always preempt task B if needed Task B will be forced to miss its deadline to help task A meet its deadline EDF – Each task has varying priority. So? –This priority depends upon when the task’s deadline is, and hence when the task becomes ready to run (arrival time) Task B may have higher priority than A depending on arrival times To determine whether task A or B will miss its deadline we need to know their arrival times