Static priority scheduling

Similar documents
Static-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Static-priority Scheduling

Scheduling Periodic Real-Time Tasks on Uniprocessor Systems. LS 12, TU Dortmund

Schedulability of Periodic and Sporadic Task Sets on Uniprocessor Systems

Deadline-driven scheduling

Real-Time and Embedded Systems (M) Lecture 5

Clock-driven scheduling

Priority-driven Scheduling of Periodic Tasks (1) Advanced Operating Systems (M) Lecture 4

Real-time Scheduling of Periodic Tasks (2) Advanced Operating Systems Lecture 3

EDF Scheduling. Giuseppe Lipari May 11, Scuola Superiore Sant Anna Pisa

Andrew Morton University of Waterloo Canada

Real-time Scheduling of Periodic Tasks (1) Advanced Operating Systems Lecture 2

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

EDF Scheduling. Giuseppe Lipari CRIStAL - Université de Lille 1. October 4, 2015

Non-preemptive Fixed Priority Scheduling of Hard Real-Time Periodic Tasks

Scheduling Algorithms for Multiprogramming in a Hard Realtime Environment

Real-Time Systems. Lecture #14. Risat Pathan. Department of Computer Science and Engineering Chalmers University of Technology

Real-Time Systems. Event-Driven Scheduling

RUN-TIME EFFICIENT FEASIBILITY ANALYSIS OF UNI-PROCESSOR SYSTEMS WITH STATIC PRIORITIES

Lecture 13. Real-Time Scheduling. Daniel Kästner AbsInt GmbH 2013

Embedded Systems 15. REVIEW: Aperiodic scheduling. C i J i 0 a i s i f i d i

Multiprocessor Scheduling II: Global Scheduling. LS 12, TU Dortmund

Non-Preemptive and Limited Preemptive Scheduling. LS 12, TU Dortmund

There are three priority driven approaches that we will look at

3. Scheduling issues. Common approaches 3. Common approaches 1. Preemption vs. non preemption. Common approaches 2. Further definitions

Embedded Systems Development

Bounding the End-to-End Response Times of Tasks in a Distributed. Real-Time System Using the Direct Synchronization Protocol.

Lecture: Workload Models (Advanced Topic)

Real-Time Systems. Event-Driven Scheduling

Schedulability analysis of global Deadline-Monotonic scheduling

Real-time Systems: Scheduling Periodic Tasks

Rate-monotonic scheduling on uniform multiprocessors

EDF Feasibility and Hardware Accelerators

Real-time scheduling of sporadic task systems when the number of distinct task types is small

Schedulability and Optimization Analysis for Non-Preemptive Static Priority Scheduling Based on Task Utilization and Blocking Factors

Aperiodic Task Scheduling

An Improved Schedulability Test for Uniprocessor. Periodic Task Systems

IN4343 Real Time Systems April 9th 2014, from 9:00 to 12:00

Segment-Fixed Priority Scheduling for Self-Suspending Real-Time Tasks

Dynamic-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Dynamic-priority Scheduling

Task Models and Scheduling

AS computer hardware technology advances, both

A Theory of Rate-Based Execution. A Theory of Rate-Based Execution

Real-Time Scheduling and Resource Management

Multiprocessor Scheduling I: Partitioned Scheduling. LS 12, TU Dortmund

On the Soft Real-Time Optimality of Global EDF on Multiprocessors: From Identical to Uniform Heterogeneous

CIS 4930/6930: Principles of Cyber-Physical Systems

2.1 Task and Scheduling Model. 2.2 Definitions and Schedulability Guarantees

Embedded Systems 14. Overview of embedded systems design

An Improved Schedulability Test for Uniprocessor Periodic Task Systems

Real-Time Scheduling. Real Time Operating Systems and Middleware. Luca Abeni

Exact speedup factors and sub-optimality for non-preemptive scheduling

A Note on Modeling Self-Suspending Time as Blocking Time in Real-Time Systems

On-line scheduling of periodic tasks in RT OS

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II

Multiprocessor Real-Time Scheduling Considering Concurrency and Urgency

The Partitioned Dynamic-priority Scheduling of Sporadic Task Systems

Non-Work-Conserving Non-Preemptive Scheduling: Motivations, Challenges, and Potential Solutions

Lec. 7: Real-Time Scheduling

Paper Presentation. Amo Guangmo Tong. University of Taxes at Dallas February 11, 2014

Optimal Utilization Bounds for the Fixed-priority Scheduling of Periodic Task Systems on Identical Multiprocessors. Sanjoy K.

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

Networked Embedded Systems WS 2016/17

EDF and RM Multiprocessor Scheduling Algorithms: Survey and Performance Evaluation

Supplement of Improvement of Real-Time Multi-Core Schedulability with Forced Non- Preemption

Tardiness Bounds for FIFO Scheduling on Multiprocessors

Paper Presentation. Amo Guangmo Tong. University of Taxes at Dallas January 24, 2014

Semi-Partitioned Fixed-Priority Scheduling on Multiprocessors

Tardiness Bounds under Global EDF Scheduling on a. Multiprocessor

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #7: More on Uniprocessor Scheduling

Load Regulating Algorithm for Static-Priority Task Scheduling on Multiprocessors

CEC 450 Real-Time Systems

Real-Time Workload Models with Efficient Analysis

Real-Time Systems. Lecture 4. Scheduling basics. Task scheduling - basic taxonomy Basic scheduling techniques Static cyclic scheduling

Multiprocessor EDF and Deadline Monotonic Schedulability Analysis

System Model. Real-Time systems. Giuseppe Lipari. Scuola Superiore Sant Anna Pisa -Italy

A New Task Model and Utilization Bound for Uniform Multiprocessors

Real-Time Scheduling

CPU SCHEDULING RONG ZHENG

Tardiness Bounds under Global EDF Scheduling on a Multiprocessor

Laxity dynamics and LLF schedulability analysis on multiprocessor platforms

End-to-End Scheduling to Meet Deadlines in Distributed Systems

A New Sufficient Feasibility Test for Asynchronous Real-Time Periodic Task Sets

Scheduling Slack Time in Fixed Priority Pre-emptive Systems

Worst-case response time analysis of real-time tasks under fixed-priority scheduling with deferred preemption revisited

Improved Priority Assignment for the Abort-and-Restart (AR) Model

Schedulability Analysis of the Linux Push and Pull Scheduler with Arbitrary Processor Affinities

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach

Improved Deadline Monotonic Scheduling With Dynamic and Intelligent Time Slice for Real-time Systems

Predictability of Least Laxity First Scheduling Algorithm on Multiprocessor Real-Time Systems

Mixed Criticality in Safety-Critical Systems. LS 12, TU Dortmund

Multiprocessor Scheduling of Age Constraint Processes

arxiv: v1 [cs.os] 21 May 2008

Mitra Nasri* Morteza Mohaqeqi Gerhard Fohler

Bounding the Maximum Length of Non-Preemptive Regions Under Fixed Priority Scheduling

arxiv: v3 [cs.ds] 23 Sep 2016

Exam Spring Embedded Systems. Prof. L. Thiele

Spare CASH: Reclaiming Holes to Minimize Aperiodic Response Times in a Firm Real-Time Environment

Embedded Systems - FS 2018

Time and Schedulability Analysis of Stateflow Models

Multi-core Real-Time Scheduling for Generalized Parallel Task Models

Transcription:

Static priority scheduling Michal Sojka Czech Technical University in Prague, Faculty of Electrical Engineering, Department of Control Engineering November 8, 2017 Some slides are derived from lectures by Steve Goddard and James H. Anderson 1 / 58

Classification of scheduling algorithms (used in real-time systems) Scheduling algorithms Off-line scheduling (static, clock-driven) On-line scheduling (dynamic) Static-priority scheduling (VxWorks, SCHED_FIFO) Deadline-driven scheduling (EDF, ) General purpose OS scheduling (fair, interactive, ) 2 / 58

Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 3 / 58

Introduction Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 4 / 58

Introduction Static priority scheduling Fixed-priority scheduling All jobs of a single task have the same (static, fixed) priority We will assume that tasks are indexed in decreasing priority order, i.e. τ i has higher priority than τ k if i < k. Notation We will assume that no two tasks have the same priority. p i denotes the priority of τ i. hp(τ i ) denotes the subset of tasks with higher priority than τ i. 5 / 58

Introduction Basic questions How to assign task priorities? How to verify that all deadlines are met (schedulability)? 6 / 58

RM and DM scheduling and their optimality Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 7 / 58

RM and DM scheduling and their optimality Rate-Monotonic scheduling CZ: Rozvrhování podle frekvence (Liu, Layland) Rate-Monotonic priority assignment The less period T i the higher priority p i. For every two tasks τ i and τ j : T i < T j p i > p j. Example (RM schedule) Three tasks (T, C): τ 1 = (3, 0.5), τ 2 = (4, 1) a τ 3 = 6, 2. 8 / 58

RM and DM scheduling and their optimality Rate-Monotonic priority assignment Example Task Period Priority τ 1 25 0 τ 2 60 2 τ 3 42 1 τ 4 105 4 τ 5 75 3 9 / 58

RM and DM scheduling and their optimality Deadline-Monotonic scheduling Rozvrhování podle termínu dokončení (Leung, Whitehead) Deadline-Monotonic priority assignment The earlier deadline D i, the higher priority p i. Pro each two tasks τ i a τ j : D i < D j p i > p j. Example (DM schedule) Let s change the RM example by tightening deadline of τ 2 : τ 1 = (3, 0.5), τ 2 = (4, 1, 2) a τ 3 = 6, 2. 10 / 58

RM and DM scheduling and their optimality τ 1 0 50 100 150 200 250 τ 2 0 62.5 125 187.5 250 τ 3 0 125 250 RM vs. DM The periodic tasks given by tuple (r i, T i, C i, D i ): τ 1 = (50, 50, 25, 100) τ 2 = (0, 62.5, 10, 20) τ 3 = (0, 125, 25, 50) DM schedule 11 / 58

RM and DM scheduling and their optimality τ 1 0 50 100 150 200 250 RM vs. DM The periodic tasks given by tuple (r i, T i, C i, D i ): τ 1 = (50, 50, 25, 100) τ 2 = (0, 62.5, 10, 20) τ 3 = (0, 125, 25, 50) τ 2 0 62.5 125 187.5 250 deadline miss τ 3 0 125 250 deadline miss RM schedule DM fails RM fails. DM can produce feasible schedule when RM fails. 12 / 58

RM and DM scheduling and their optimality τ 1 0 2 4 6 8 10 τ 2 0 5 10 RM and DM optimality Theorem Neither RM nor DM is optimal. Proof. Consider τ 1 = (2, 1) a τ 2 = (5, 2.5). Total system utilization is 1, so the system is schedulable (see the EDF lecture). However, under RM or DM, a deadline will be missed, regardless of how we choose to (statically) prioritize τ 1 and τ 2. 13 / 58

RM and DM scheduling and their optimality Simply periodic systems RM algorithm is optimal when the periodic tasks in the system are simply periodic and the deadlines of the tasks are no less than their respective periods. Definition A system of periodic tasks is simply periodic 1 if for every pair of tasks τ i and τ k in the system where T i < T k, T k is an integer multiple of T i. Theorem A system T of simply periodic, independent, preemptable tasks, whose relative deadlines are at least their periods, is schedulable on one processor according to the RM algorithm if and only if its total utilization is at most one. 1 CZ: jednoduše periodický 14 / 58

RM and DM scheduling and their optimality Proof We wish to show: U 1 T is schedulable. We prove the contrapositive: T is not scheulable U > 1. Assume T is not schedulable. Let J i,k be the first job to miss its deadline. τ i t 1 r i,k r i,k+1 Note: We suppose that tasks are in phase (not shown in the figure above) and processor never idles before J i,k missed its deadline. Because the system is simply periodic, r i,k+1 t 1 is integer. T j 15 / 58

RM and DM scheduling and their optimality Proof (cont.) Because J i,k missed its deadline, the demand placed on the processor in [t 1, r i,k+1 ) by jobs of tasks τ 1,..., τ i is grater than the available processor time in [t 1, r i,k+1 ]. Thus: r i,k+1 t 1 = available processor time in [t 1, r i,k+1 ] < < demand placed on processor in [t 1, r i,k+1 ] by jobs τ 1,..., τ i = i = (the number of jobs of τ j released in [t 1, r i,k+1 ]) C j j=1 i j=1 r i,k+1 t 1 T j C j 16 / 58

RM and DM scheduling and their optimality Proof (cont.) This we have r i,k+1 t 1 < Canceling r i,k+1 t 1 yields i j=1 r i,k+1 t 1 T j C j 1 < i j=1 C j T j, i.e. This completes the proof. 1 < U i < U, 17 / 58

RM and DM scheduling and their optimality Optimality among fixed-priority algorithms Theorem A system T of independent, preemptable, periodic, synchronous tasks that have relative deadlines at most their respective periods can be feasibly scheduled on one processor according to the DM algorithm whenever it can be feasibly scheduled according to any fixed-priority algorithm. Corollary The RM algorithm is optimal among all fixed-priority algorithms whenever the relative deadlines of all tasks are proportional to their periods. 18 / 58

RM and DM scheduling and their optimality Proof We can always transform a feasible static-priority schedule that is not a DM schedule into one that is. Suppose τ 1,..., τ i are prioritized not in accordance with DM. Suppose τ i has a longer relative deadline than τ i+1, but τ i a higher priority than τ i+1. Then, we can interchange τ i and τ i+1 (switch the priorities) and adjust the schedule accordingly by swapping pieces of τ i with pieces of τ i+1. τ i τ i+1 τ i+2 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 19 / 58

RM and DM scheduling and their optimality Proof (cont.) After the switch, the priorities of the two tasks are assigned on the DM basis relative to the other tasks. τ i+1 0 1 2 3 4 5 6 7 8 9 10 11 12 τ i τ i+2 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 By induction, we can correct all such situations and transform the given schedule into DM schedule. Note: It is always possible to switch the priorities of tasks and hence the time intervals without leading to any missed deadline when tasks are in phase. Why? 20 / 58

Utilization-based schedulability tests Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 21 / 58

Utilization-based schedulability tests Utilization-based RM schedulability test CZ: Test rozvrhnutelnosti RM na základě zatížení Theorem (Liu, Layland) A system of n independent, preemptable periodic tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor according to the RM algorithm if its total utilization U = n i=1 u i satisfies: U n(2 1 n 1) U RM (n) = n(2 1 n 1) is the schedulable utilization of the RM algorithm. Note: This is only a sufficient (not necessary) schedulability test. 22 / 58

Utilization-based schedulability tests U RM as a function of n n U RM (n) 2 0.828 3 0.779 4 0.756 5 0.743 6 0.734 7 0.728 8 0.724 9 0.720 10 0.717.. ln 2 0.693 23 / 58

Utilization-based schedulability tests Proof See Liu s book. 24 / 58

Utilization-based schedulability tests Other utilization-based tests Liu s book presents several other utilization-based schedulability tests. Some of these tests result in higher schedulable utilizations for certain kinds of task sets. Other deal with different task models such as those similar to MPEG decoder. 25 / 58

Time demand analysis and variants Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 26 / 58

Time demand analysis and variants Critical instant The following analysis methods are based on a notion of critical instant. Definition (Critical instant) Critical instant of a task τ i is a time instant such that: 1 the job of τ i released at this instant has the maximum response time of all jobs in τ i, if the response time of every job of τ i is at most D i, the relative deadline of τ i and 2 the response time of the job released at this instant is greater than D i if the response time of some jobs in τ i exceeds D i. Informally, a critical instant of τ i represents a worst-case scenario from τ i standpoint. 27 / 58

Time demand analysis and variants Critical instant in static-priority systems Theorem (Liu, Layland) In a fixed-priority system where every job completes before the next job of the same task is released, a critical instant of any task τ i occurs when one of its job J i,c is released at the same time with a job of every higher priority task. τ 1 τ 2 τ 3 0 1 2 3 4 5 6 7 8 9 10 11 12 Critical instant of τ 3 is 0. We are not saying that τ 1,..., τ i will all necessarily release jobs at the same time, but if this does happen, we are claiming that the time of release will be a critical instant for τ i. 28 / 58

Time demand analysis and variants Time demand analysis Time-demand analysis (TDA) CZ: Analýza časové poptávky Compute the total demand for processor time by a job released at a critical instant of the task and by all the higher-priority tasks. Check whether this demand can be met before the deadline of the job. TDA can be applied to produce a schedulability test for any static-priority algorithm that ensures that each job of every task completes before the next job of that task is released. For some important task models and scheduling algorithms, this schedulability test will be necessary and sufficient. Time-demand analysis was proposed by Lehoczky, Sha, and Ding. 29 / 58

Time demand analysis and variants Time demand analysis Scheduling condition Definition The time demand function of the task τ i, denoted w i (t), is defined as follows. i 1 t w i (t) = C i + k=1 T k C k for 0 < t T i. Note: We are still assuming tasks are indexed by priority. For any static-priority algorithm A that ensures that each job of every task completes by the time the next job of that task is released. Theorem System T of periodic, independent, preemptable tasks is schedulable on one processor by algorithm A if the following holds. i : t : w i (t) t, 0 < t T i. 30 / 58

Time demand analysis and variants Time demand analysis Necessity and sufficiency Condition i : t : w i (t) t, 0 < t T i is necessary for synchronous real periodic task systems and real sporadic task systems. Why? For a given i, we don t really have to consider all t in the range 0 < t T i. Two ways to avoid this: 1 Iterate using t (k+1) := w i (t (k) ), starting with a suitable t (0) (e.g. t (0) = C i ) and stopping when, for some n, t (n) w i (t (n) ) or t (n) > T i. 2 Only consider t = j T k, where k = 1, 2,..., i; j = 1, 2,..., min(t i, D i )/T k. Explanation is in Liu s book. 31 / 58

Time demand analysis and variants Response-time analysis Response-time analysis CZ: Výpočet doby odezvy A special (simple) case of Time Demand Analysis If we know the critical instant, we can find task s worst-case response time by simulating the schedule from the critical instant. The found worst-case response time R i is compared with the corresponding deadline: R i D i The response time can be calculated as follows: R i = C i + I i, where I i denotes the interference from higher priority tasks. In time interval [0, R i ) the higher priority task τ j will be executed several times: Ri number of τ j executions = T j Total interference from τ j to τ i is: I i,j = Ri T j C j 32 / 58

Time demand analysis and variants Response-time analysis Response-time analysis (cont.) R i = C i + R i = C i + I i,j j hp(i) Ri j hp(i) T j C j 33 / 58

Time demand analysis and variants Response-time analysis Response-time analysis (cont.) R i = C i + R i = C i + I i,j j hp(i) Ri j hp(i) T j C j 34 / 58

Time demand analysis and variants Response-time analysis Response-time analysis (cont.) R i = C i + R i = C i + I i,j j hp(i) Ri j hp(i) T j C j Can be calculated by the recurrence formula: = C i + w n i w n+1 i j hp(i) T j C j Sequence w 0 i, w1 i,... is monotonically non-decreasing. If wn i = w n+1 i then it is the solution of the equation. Choice of w 0 i is important. It should not be greater than R i. We can start with 0 or C i. 35 / 58

Time demand analysis and variants Response-time analysis Response-time analysis example Example Task Period Execution time τ a 7 3 τ b 12 3 τ c 20 5 R a = 3 w 0 b = 3 3 w 1 b = 3 + 3 = 6 7 6 w 2 b = 3 + 3 = 6 7 R b = 6 36 / 58

Time demand analysis and variants Response-time analysis Response-time analysis example (cont.) Example w 0 c = 5 5 5 w 1 c = 5 + 3 + 3 = 11 7 12 11 11 w 2 c = 5 + 3 + 3 = 14 7 12 14 14 w 3 c = 5 + 3 + 3 = 17 7 12 17 17 w 4 c = 5 + 3 + 3 = 20 7 12 20 20 w 5 c = 5 + 3 + 3 = 20 7 12 R c = 20 37 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Fixed-priority tasks with arbitrary deadlines D i > T i More than one job of a task can be ready for execution at a time. We assume that jobs are schedules in FIFO order. TDA schedulability condition holds only if d i,k < r i,k+1 38 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Busy interval Definition (Level-p i busy interval) A level-p i busy interval(t 0, t] begins at an instant t 0, when 1 all jobs in hp(τ i ) released before the instant have completed and 2 a job in hp(τ i ) is released. The interval ends at the first instant t after t 0 when all the jobs in hp(t i ) released since t 0 are complete. Example (Priority p i = i) τ 1 τ 2 τ 3 0 1 2 3 4 5 6 7 8 9 10 11 12

Time demand analysis and variants Tasks with arbitrary deadlines Busy interval Definition (Level-p i busy interval) A level-p i busy interval(t 0, t] begins at an instant t 0, when 1 all jobs in hp(τ i ) released before the instant have completed and 2 a job in hp(τ i ) is released. The interval ends at the first instant t after t 0 when all the jobs in hp(t i ) released since t 0 are complete. Example (Priority p i = i) τ 1 τ 2 Level-1 busy interval Level-2 busy interval τ 3 0 1 2 3 4 5 6 7 8 9 10 11 12 Level-3 busy interval

Time demand analysis and variants Tasks with arbitrary deadlines Busy interval Definition (Level-p i busy interval) A level-p i busy interval(t 0, t] begins at an instant t 0, when 1 all jobs in hp(τ i ) released before the instant have completed and 2 a job in hp(τ i ) is released. The interval ends at the first instant t after t 0 when all the jobs in hp(t i ) released since t 0 are complete. Example (Priority p i = i) τ 1 τ 2 Level-1 busy interval Level-1 busy interval Level-2 busy interval Level-2 busy interval τ 3 0 1 2 3 4 5 6 7 8 9 10 11 12 Level-3 busy interval 41 / 58

Time demand analysis and variants Tasks with arbitrary deadlines In phase busy interval Definition A level-p i busy interval is in phase if the first jobs of all tasks in hp(τ i ) that are executed in this interval have the same release time. Example (Priority p i = i) τ 1 τ 2 In phase level-2 busy interval τ 3 0 1 2 3 4 5 6 7 8 9 10 11 12 In phase level-3 busy interval 42 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Analysis of tasks with arbitrary deadlines is not as easy Lehoczky counterexample Consider two tasks τ 1 = (70, 26), τ 2 = (100, 62). Schedule: τ 1 0 70 140 210 280 350 420 490 560 630 700 τ 2 0 100 200 300 400 500 600 700 Seven jobs of τ 2 execute in the first level-2 busy interval. Their response times are: 114, 102, 116, 104, 118, 106, 94. Response time of the first job is not the largest. 43 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation Test one task at a time from τ 1 to τ N (see next slides). For the purpose of determining whether a task τ i is schedulable, assume that all the tasks are in phase and the first level-p i busy interval begins at time 0. While testing whether all the jobs in τ i can meet their deadlines (i.e., whether τ i is schedulable), consider the subset hp(τ i ) of tasks. 44 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation (cont.) 1 If the first job of every task in hp(τ i ) completes by the end of the first period of the task, check whether the first job τ i,1 meets its deadline. τ i is schedulable if τ i,1 completes in time. Otherwise, τ i is not schedulable. 2 2 The same case as if D i T i 45 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation (cont.) 1 If the first job of every task in hp(τ i ) completes by the end of the first period of the task, check whether the first job τ i,1 meets its deadline. τ i is schedulable if τ i,1 completes in time. Otherwise, τ i is not schedulable. 2 2 If the first job of some task in hp(τ i ) does not complete by the end of the first period of the task, do the following: 2 The same case as if D i T i 46 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation (cont.) 1 If the first job of every task in hp(τ i ) completes by the end of the first period of the task, check whether the first job τ i,1 meets its deadline. τ i is schedulable if τ i,1 completes in time. Otherwise, τ i is not schedulable. 2 2 If the first job of some task in hp(τ i ) does not complete by the end of the first period of the task, do the following: a Compute the length of the in phase level-p i busy interval by solving the equation t = i k=1 t T k C k iteratively, starting from t (1) = ik=1 C k until t (l+1) = t (l) for some l1. The solution t (l) is the length of the level-p i busy interval. 2 The same case as if D i T i 47 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation (cont.) 1 If the first job of every task in hp(τ i ) completes by the end of the first period of the task, check whether the first job τ i,1 meets its deadline. τ i is schedulable if τ i,1 completes in time. Otherwise, τ i is not schedulable. 2 2 If the first job of some task in hp(τ i ) does not complete by the end of the first period of the task, do the following: a Compute the length of the in phase level-p i busy interval by solving the equation t = i k=1 t T k C k iteratively, starting from t (1) = ik=1 C k until t (l+1) = t (l) for some l1. The solution t (l) is the length of the level-p i busy interval. b Compute the maximum response times of all t (l) /T i jobs of τ i in the in-phase level-p i busy interval in the manner described next and determine whether they complete in time. 2 The same case as if D i T i 48 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation (cont.) 1 If the first job of every task in hp(τ i ) completes by the end of the first period of the task, check whether the first job τ i,1 meets its deadline. τ i is schedulable if τ i,1 completes in time. Otherwise, τ i is not schedulable. 2 2 If the first job of some task in hp(τ i ) does not complete by the end of the first period of the task, do the following: a Compute the length of the in phase level-p i busy interval by solving the equation t = i k=1 t T k C k iteratively, starting from t (1) = ik=1 C k until t (l+1) = t (l) for some l1. The solution t (l) is the length of the level-p i busy interval. b Compute the maximum response times of all t (l) /T i jobs of τ i in the in-phase level-p i busy interval in the manner described next and determine whether they complete in time. c τ i is schedulable if all these jobs complete in time; otherwise τ i is not schedulable. 2 The same case as if D i T i 49 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation of the first job Step 2b Almost the same as in the time demand analysis for D i T i. The time-demand function w i,1 is defined as follows: i 1 t w i,1 (t) = C i + k=1 T k C k for 0 < t w i,1 (t) The only difference is here. The maximum possible response time R i,1 of job τ i,1 is R i,1 = min{t t = w i,1 (t)} The same iterative computation as in response-time analysis. 50 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation for any job in the busy interval Step 2b Lemma The maximum response time R i,j of the j-th job of τ i in an in-phase level-p i busy interval is { ( ) } R i,j = min t t = w i,j t + (j 1)Ti (j 1)Ti, }{{} Release time of j-th job where i 1 t w i,j (t) = jc i + k=1 T k C k for (j 1)T i < t w i,j (t). Can be solved by the recurence relation as before. 51 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Response time calculation for any job in the busy interval Step 2b Lemma The maximum response time R i,j of the j-th job of τ i in an in-phase level-p i busy interval is { ( ) } R i,j = min t t = w i,j t + (j 1)Ti (j 1)Ti, }{{} Release time of j-th job where i 1 t w i,j (t) = jc i + k=1 T k C k for (j 1)T i < t w i,j (t). Can be solved by the recurence relation as before. 52 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Example Let us apply the previous Lemma to the Lehoczky example: τ 1 = (70, 26), τ 2 = (100, 62). τ 1 0 70 140 210 280 350 420 490 560 630 700 τ 2 0 100 200 300 400 500 600 700 1) Does not apply because R 2,1 > T 2. 2a) The length of level-2 busy interval is 694. 2b) Compute response times R 2,j for 1 j 695/100 = 7. 53 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Example calculation of R 2,1 τ 1 = (70, 26), τ 2 = (100, 62). τ 1 0 70 140 210 280 350 420 490 560 630 700 τ 2 0 100 200 300 400 500 600 700 R 2,1 = minimal t satisfying: 2 1 t t = w 2,1 (t) = C 2 + = 62 + t/70 26 k=1 T k C k Try substitute 114 for t: 114 = 62 + 114/70 26 = = 62 + 2 26 = = 114 OK! What if we don t know what to substitute? 54 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Example calculation of R 2,2 τ 1 = (70, 26), τ 2 = (100, 62). τ 1 0 70 140 210 280 350 420 490 560 630 700 τ 2 0 100 200 300 400 500 600 700 R 2,2 = minimal t satisfying: t = w 2,2 (t + T 2 ) T 2 = 2 1 t + 100 = 2C 2 + C k 100 = k=1 T k = 124 + (t + 100)/70 26 100 Try substitute 102 for t: 102 = 124 + 202/70 26 100 = = 124 + 3 26 100 = = 102 OK! 55 / 58

Time demand analysis and variants Tasks with arbitrary deadlines Example calculation of R 2,3 τ 1 = (70, 26), τ 2 = (100, 62). τ 1 0 70 140 210 280 350 420 490 560 630 700 τ 2 0 100 200 300 400 500 600 700 R 2,3 = minimal t satisfying: t = w 2,3 (t + 2T 2 ) 2T 2 = 2 1 t + 200 = 3C 2 + C k 200 = k=1 T k = 186 + (t + 200)/70 26 200 Try substitute 116 for t: 116 = 186 + 316/70 26 200 = = 186 + 5 26 200 = = 116 OK! 56 / 58

Summary Outline 1 Introduction 2 RM and DM scheduling and their optimality 3 Utilization-based schedulability tests 4 Time demand analysis and variants Time demand analysis Response-time analysis Tasks with arbitrary deadlines 5 Summary 57 / 58

Summary Summary RM and DM are optimal among fixed priority scheduling algorithms. Utilization based test is simple but only a sufficient condition. Response time analysis is both sufficient and necessary. Generic time demand analysis can handle many cases not covered by response time analysis. 58 / 58