CSE 522 Real-Time Scheduling (2)

Slides:



Advertisements
Similar presentations
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
Advertisements

Washington WASHINGTON UNIVERSITY IN ST LOUIS Real-Time: Periodic Tasks Fred Kuhns Applied Research Laboratory Computer Science Washington University.
Time Demand Analysis.
Introduction to Embedded Systems Resource Management - III Lecture 19.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
CPE555A: Real-Time Embedded Systems
CSE 522 Real-Time Scheduling (3)
CSE 522 Real-Time Scheduling (4)
Harini Ramaprasad, Frank Mueller North Carolina State University Center for Embedded Systems Research Tightening the Bounds on Feasible Preemption Points.
Mehdi Kargahi School of ECE University of Tehran
Real-time Systems Lab, Computer Science and Engineering, ASU Scheduling Algorithm and Analysis (ESP – Fall 2014) Computer Science & Engineering Department.
Real-Time Scheduling CIS700 Insup Lee October 3, 2005 CIS 700.
Task Allocation and Scheduling n Problem: How to assign tasks to processors and to schedule them in such a way that deadlines are met n Our initial focus:
1 Swiss Federal Institute of Technology Computer Engineering and Networks Laboratory Embedded Systems Exercise 2: Scheduling Real-Time Aperiodic Tasks.
Module 2 Priority Driven Scheduling of Periodic Task
Problem 11: Complex Hierarchical Scheduling Full Processor FP T3T2 T4T1 EDF T6T5 RM T10T9T8T7 EDFSPS DPS 10 Tasks - with jitter - with bursts - deadline.
Towards Feasibility Region Calculus: An End-to-end Schedulability Analysis of Real- Time Multistage Execution William Hawkins and Tarek Abdelzaher Presented.
Periodic Task Scheduling
Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
EE 249, Fall Discussion: Scheduling Haibo Zeng Amit Mahajan.
Embedded Systems Exercise 3: Scheduling Real-Time Periodic and Mixed Task Sets 18. May 2005 Alexander Maxiaguine.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
Misconceptions About Real-time Computing : A Serious Problem for Next-generation Systems J. A. Stankovic, Misconceptions about Real-Time Computing: A Serious.
Technische Universität Dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2007/12/14.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Scheduling policies for real- time embedded systems.
DESIGNING VM SCHEDULERS FOR EMBEDDED REAL-TIME APPLICATIONS Alejandro Masrur, Thomas Pfeuffer, Martin Geier, Sebastian Drössler and Samarjit Chakraborty.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Real-Time Scheduling CS 3204 – Operating Systems Lecture 20 3/3/2006 Shahrooz Feizabadi.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
6. Application mapping 6.1 Problem definition
Undergraduate course on Real-time Systems Linköping 1 of 45 Autumn 2009 TDDC47: Real-time and Concurrent Programming Lecture 5: Real-time Scheduling (I)
Real Time Systems Real-Time Schedulability Part I.
RTOS task scheduling models
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
KUKUM Real Time System 1/21 Module 2 Real Time System Scheduling Lecture 05.
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010.
Special Class on Real-Time Systems
Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1.
Real-Time Scheduling CS 3204 – Operating Systems Lecture 13 10/3/2006 Shahrooz Feizabadi.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Dynamic Priority Driven Scheduling of Periodic Task
Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2012 年 12 月 19 日 These slides use Microsoft clip.
Mok & friends. Resource partition for real- time systems (RTAS 2001)
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
2/23/2016COSC , Lecture 21 Real-Time Systems, COSC , Lecture 2 Stefan Andrei.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
1 Independent Task Scheduling Real-Time Computing 羅習五 本份投影片大量參考交通大學 張立平教授的投影片.
Lecture 6: Real-Time Scheduling
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
Real-Time Operating Systems RTOS For Embedded systems.
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.
Embedded System Scheduling
EEE 6494 Embedded Systems Design
Process Scheduling B.Ramamurthy 11/18/2018.
Real Time Scheduling Mrs. K.M. Sanghavi.
CSCI1600: Embedded and Real Time Software
Process Scheduling B.Ramamurthy 2/23/2019.
CSCI1600: Embedded and Real Time Software
Processes and operating systems
The End Of The Line For Static Cyclic Scheduling?
Ch 4. Periodic Task Scheduling
Presentation transcript:

CSE 522 Real-Time Scheduling (2) Computer Science & Engineering Department Arizona State University Tempe, AZ 85287 Dr. Yann-Hang Lee yhlee@asu.edu (480) 727-7507

Priority-Driven Scheduling of Periodic Tasks Why priority-driven scheduling use priority to represent urgency easy implementation of scheduler (compare priorities and dispatch tasks) tasks can be added or removed easily no direct control of execution instant How can we analyze the schedulability if we don’t know when a task is to be executed Let’s begin a deterministic case in one processor independent periodic tasks deadline = period preemptable no overhead for context switch

Priority-Driven Schedules Assign priority when jobs arrive static -- all jobs of a task have a fixed priority dynamic -- different priorities to individual jobs of a task relative priorities don’t change while jobs are waiting Static priority schedules Rate-monotonic -- the smaller a task priority, the higher its priority Deadline-monotonic Dynamic priority schedules EDF -- earliest deadline first LSTF -- least slack time first Schedulable utilization: a scheduling algorithm can feasibly schedule any sets of priority tasks if the total utilization is equal to or less than the schedulable utilization of the algorithm

EDF Schedule A optimal algorithm under single processor and preemptable tasks How do we know a set of periodic tasks are schedulable under EDF ? If we know the schedulable utilization SU of EDF, then any sets of tasks are schedulable when U  SU Theorem: A set of n periodic tasks can be scheduled by EDF iff Proof the only-if part is obvious the if part --- show if there is a job misses its deadline, then U > 1

EDF Schedule Let the 1st unschedulable job be Ji,c that misses its deadline at t and the processor is never idle during [0,t] how much execution we have done before t Case 1: no type D jobs and let’s ignore type C jobs Case 2: if type D jobs exist and are executed before r let t’ be the latest instant that type D jobs execute how much execution we have done in [t’, t] Ji,c is released Ji,c misses its deadline t r A B C D

Extension of EDF Schedulable Utilization If Di  pi, EDF is schedulable iff U  1 What can we do if Di < pi density of task k : k = ek / min(pk,Dk) EDF is schedulable if the total density is equal to or less than 1 proof: if there is a job missing its deadline, then the total density > 1 there is no “only-if” part ---- if the total density > 1, EDF may or may not schedulable If Di  pi, LSTF is schedulable iff U  1 Predicable for single-processor preemptive schedule of independent tasks Robust independent of phases periods are lower bound  applicable to sporadic tasks with minimum separations

General EDF Feasibility Analysis Processor demand: all processing request during a period [ti, t2), i.e., Loading factor: Each set of real-time jobs is feasibly scheduled by EDF iff How to compute loading factor?

Sporadic Tasks under EDF minimum separation Ti ≠ Di Worst possible scenario: arrives synchronously at the maximum rate A sporadic task set is feasibly scheduled by EDF iff Need to show that Hybrid task sets (with both periodic and sporadic task) are schedulable under EDF if

EDF Schedulability Test If Di ≤ Ti and synchronous task sets loading factor u[0,t)≤1 for all t L: synchronous busy period, can be compute iteratively by Test loading factor at deadline instants that are less than L

EDF Scheduling Example L0=7, L1=9, L2=11, L3=14, L4=16 the set of points to be tested: D={4,5,7,10,13,16} Task(i) Period WCET Deadline 1 6 2 4 2 8 5 3 9 3 7 t h u 4 2 0.5 5 0.8 7 1 10 9 0.9 13 11 0.85 16

Example of EDF Schedule A digital robot with EDF schedule control loop: ec  8ms at 100Hz BIST: eb  50ms given BIST can be done every 250ms Add a telemetry task to send and receive messages with et  15ms if BIST is done every 1000ms the telemetry task can have a relative deadline of 100ms  sending or receiving must be separated at least 100ms

Rate-Monotonic Algorithm A base case: no additional overhead, simple periodic tasks with pi =Di Assign priorities according their periods Ti has a higher priority that Tk if i < k ( pi < pk ) Is RM optimal?  if there is a feasible fixed-priority schedule, then RM is feasible How do we know RM is feasible  schedulability test Results: RM is optimal if pi  Di sufficient condition  utilization test a complete test  what is the worst response time given all possible arrivals and preemptions

Critical Instant Critical instant of Ti: a job of Ti arriving at the instant has a maximum response time If we can find the critical instant of Ti, then check whether all jobs of Ti meet their deadlines let’s increase ei until the maximum response time = Di  schedulable utilization In-phase instant is critical: all higher priority tasks are released at the same instant of Ji,c (assume all jobs are completed before the next job of the same task is released.) which T2 has the maximum response time T1 T2 T1, T2 T2 T1

Schedulability Test: Time-Demand Analysis Consider in-phase instant only If Ji is done at t, then the total work must be done in [0,t] is (from Ji and all higher priority tasks) Can we find a t  Di such that wi(t)  t cannot check all t  [0, Di] check all arrival instants and Di The completion time of Ji satisfies t w(t) time Di

Schedulability Test EDF has a schedulable utilization of 1, how about RMS If Di=pi, the schedulable utilization exists if U  n ( 21/n - 1 ), done else do time-demand analysis if Di < pi, do time-demand analysis if Di > pi, there may be more than one jobs of task i in the system examine all jobs of task i in a level-i busy interval (in-phase) the following equations represent:

Schedulable Utilization of RMS Must be less than 1 Let’s consider two tasks and deadline=period T2 can only be executed when T1 is not in the system Let p2 < 2p1. What is the maximum schedulable e2 If p2 < p1+e1, max(e2)=p1-e1  U=e1/p1+(p1-e1)/p2 Else, max(e2)=p2-2e1  U=e1/p1+(p2-2e1)/p2 T1 0 p1 2p1 p2 maximal e2

Schedulable Utilization of RMS Given e1, p1, and p2, plot U The minimum U occurs when p2=p1+e1 where U= e1/p1+(p1-e1)/(p1+e1) What is the minimum U take the derivative wrt to p1 and set dU/dp1=0 we will get e1=(21/2-1)p1 and U=0.828… p2=p1 2p1 U 1

Schedulable Utilization of RMA U  n ( 21/n - 1 ) Is there a case that is feasible and gives the minimal schedulable utilization When pn  2 p1 processor must be busy in [0,pn] become unscheduable if increase ei processor will be idle if increase pi T1 T2 T3 T4 T5 p5

Schedulable Utilization of RMA What do we have from the timeline diagram ek = pk+1 - pk for k=1,2,..,n-1 en = pn - 2(e1 + e2 + . . . . + en-1 ) =2p1 - pn Can we increase e1 and decrease ek by the same amount still schedulable for the 1st arrival of all tasks utilization is higher Can we decrease e1 and increase ek When will U be minimum ----- when q2,1=q3,2= . . . = 2/n

Schedulable Utilization of RMA When pn > 2pk and schedulable construct a new task set that is schedulable and pn > 2pk the original set has a higher utilization Tk Tn pn lpk

Schedulability: RT Test Theorem: for a set of independent, periodic tasks, if each task meets its first deadline, with worst-case task phasing, the deadline will always be met. Response Time (RT) test: let an = response time of task i. an may be computed by the following iterative formula: Test Terminates when an+1 = an Task i is schedulable if its response time is before its deadline: an ≤ pi

Sample Problem: UB Test Task 1 20 100 0.200 Task 2 40 150 0.267 Task 3 350 0.286 Total utilization is .200 + .267 + .286 = .753 < U(3) =.779 The periodic tasks in the sample problem are schedulable according to the UB test.

Example: Applying RT Test (1) If we increase the compute time of ז1 from 20 to 40; is the task set still schedulable? Utilization for the first task : 40/100=0.4 < U(1) Utilization of first two tasks: 0.667 < U(2) = 0.828 First two tasks are schedulable by UB test Utilization of all three tasks: 0.953 > U(3) = 0.779 UB test is inconclusive Need to apply RT test

Example: Applying RT Test (2) Use RT test to determine if ז3 meets its first deadline: i = 3

Example: Applying RT Test (3) a3 = a2 = 300 Done! Task is schedulable using RT test. a3 = 300 < p3 = 350

Modeling Task Switching

Schedulability with Interrupts Interrupt processing can be inconsistent with rate monotonic priority assignment. interrupt handler executes with high priority despite its period interrupt processing may delay execution of tasks with shorter periods Effects of interrupt processing must be taken into account in schedulability model. Task(i) Period(p) WCET(e) Priority Deadline(D) 3 200 60 HW 1 100 20 High 2 150 40 Medium 4 350 Low

UB Test with ANY FIXED PRIORITY Test is applied to each task. Determine effective utilization (fi) of each task i using when di=pi fi = Compare effective utilization against bound, U(n). n = num(Hn) + 1 num(Hn) = the number of tasks in the set Hn Preemption form the tasks that can hit more than once (with period less that pi) Execution of a task under test Preemption from tasks That can hit only once (with period greater than pi )

UB Test with Interrupt Priority Test is applied to each task. Determine effective utilization (fi) of each task i using when di<pi (ei must be done within di, not pi) fi = Compare effective utilization against bound, U(n). n = num(Hn) + 1 num(Hn) = the number of tasks in the set Hn Preemption form the tasks that can hit more than once (with period less that di) Execution of a task under test Preemption from tasks That can hit only once (with period greater than di )

UB Test with Interrupt Priority: 3 For 3, no tasks have a higher priority: H = Hn =H1 = { }. f3 = Note that utilization bound is U(1): num(Hn) = 0. f3 =

UB Test with Interrupt Priority: 1 For 1, 3 has a higher priority: H = {3}; Hn = {}; H1 = {3}. f1 = Note that utilization bound is U(1): num(Hn) = 0. f1 =

UB Test with Interrupt Priority: 2 For 2 : H={1, 3}; Hn={1 }; H1={3 }; Note that utilization bound is U(2): num(Hn) = 1.

UB Test with Interrupt Priority: For 4 : H={1, 2, 3}; Hn={1 , 2, 3 }; H1={}; Note that utilization bound is U(4): num(Hn) = 3.

Is There a RT Analysis for EDF Does a critical instant exist? releasing task instance i at the start of the busy period may not lead to its worst-case response time. i arrives at a with deadline d, is finished in t2 t1 the last time no pending instances with arrival time earlier than ti and deadline ≤ d [t1, t2) –the busy period of instances with deadlines ≤ d “shift left” all instances of other tasks to start at t1  increase busy period

RT Analysis for EDF (1) Deadline busy period where WCET happens: only tasks with deadlines less than and equal to d get executed started at 0 for the instance of i arrived at a: Li(a) higher priority workload Then, an iterative formula for Li(a) The response time is:

RT Analysis for EDT (2) Choice of “a”: Li(a) > a (arrives before deadline busy period ends) a+Di coincides with the absolute deadlines of other tasks in the interval [0, L-Ci), L is the busy period of synchronous arrivals

Summary of Feasibility Analysis (1) A set of tasks {Ci, Di, Ti,, i} Dynamic priority -- EDF is optimal Di ≥ Ti -- utilization bound on slide #4 (iff) Di < Ti -- all loading factor less than 1 on slide 7 (iff) Synchronous or Sporadic – busy period analysis and testing algorithm on slide #9 (iff) Asynchronous – if the cooresponding synchronous task set is schedulable. worst case execution time – slide #34 necessary condition: U ≤ 1 sufficient condition: ∑(Ci / min{Di , Ti }) ≤ 1

Summary of Feasibility Analysis (2) Static priority Rate monotonic – optimal if Di ≥ Ti Deadline monotonic – optimal if Di < Ti Necessary condition: U ≤ 1 Synchronous Sufficient condition RM and DM -- ∑(Ci / min{Di , Ti }) ≤ n(21/n-1 ) (slide #12) fixed priorities – effective utilization for each task ≤ n(21/n-1 ) (slide #28) worst case response time (i.e. 1st arrival) ≤ Di (slide #21) (iff) Asynchronous the conditions for synchronous case are sufficient

Project outline submissions 5 late submissions; one on March 31 One submitted as assignment 3 Toyota UA RTOS for automotive Systems Real-time Communication on CAN bus AFDX Avionics Network Real-time Hypervisor RTSJ and SCJ Scheduling for multicore Others 8 5 2 16 9 12 3