On the Optimality of RM and EDF for Non-Preemptive Real-Time Harmonic Tasks
description
Transcript of On the Optimality of RM and EDF for Non-Preemptive Real-Time Harmonic Tasks
THE UNIVERSITY of TEHRAN
On the Optimality of RM and EDF for Non-Preemptive Real-Time
Harmonic Tasks
Mitra Nasri Sanjoy Baruah Gerhard Fohler Mehdi Kargahi
October 2014
2 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 2 of 29
Benefits◦ No context switches◦ Cache and pipelines are not affected by other tasks
More precise estimation of WCET◦ Simpler mechanisms to protect critical sections
In some systems, preemption is either not allowed or too expensive
Non-preemptive Scheduling
Benefits from the application’s point of viewMinimum I/O delay
(the delays between sampling and actuation)
3 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Non-Preemptive Scheduling is NP-Hard◦ For Periodic Tasks [Jeffay 1991]
◦ For Harmonic Tasks [Cai 1996]
◦ For Harmonic Tasks with Binary Period Ratio [Nawrocki 1998] ki = {1, 2, 4, 8, 16, …}
Existing Results
τi -1
Ti
Ti -1
τi Period Ratio
4 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Schedulability test for npEDF, npRM, and Fixed Priority ◦ [Kim 1980, Jeffay 1991, George 1996, Park 2007, Andersson 2009, Marouf
2010,…]
Heuristic scheduling algorithms◦ Clairvoyant EDF [Ekelin 2006], Group-Based EDF [Li 2007]
Optimal scheduling algorithms for special cases ◦ [Deogun 1986, Cai 1996, Nasri 2014]
Related Works
5 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
[Deogun 1986]: An optimal algorithm if tasks have ◦ Constant integer period ratio K ≥ 3
[Cai 1996]: An optimal algorithm if tasks have ◦ Constant period ratio K = 2, or◦ Integer period ratio ki ≥ 3
Limitations Linear time in the number of jobs, exponential time in the number
of tasks! Constructs an offline time table with exponential number of entries
Optimal Algorithms for Harmonic Tasks
Period Ratio
An optimal scheduling algorithm is the one which guarantees all deadlines whenever a feasible schedule exists
6 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Precautious-RM [Nasri 2014] is optimal if tasks have◦ Constant period ratio K = 2◦ Integer period ratio ki ≥ 3
◦ Arbitrary integer period ratio ki ≥ 1 and enough vacant intervals
Precautious-RM is online and has O(n) computational and memory complexity (in the number of tasks)
Optimal Algorithms, cont.
7 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 7 of 25A Framework to Construct Customized
Harmonic Periods for RTS
We study◦ The existence of a utilization-based test◦ The pessimism in the existing necessary and sufficient test◦ The efficiency of the recent processor speedup approach
Then for special cases of harmonic tasks we present◦ The schedulability conditions◦ A more efficient speedup factor
Contributions
8 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 8 of 29
Task set τ = {τ1, τ2, …, τn} Ti is the period of τi ci is the WCET of τi ki is the period ratio of τi to τi-1
Deadlines are implicit; Di = Ti
System Model
τi -1
Ti
Ti -1
τi Period Ratio
9 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 9 of 29
Is it possible to have a utilization-based test for non-preemptive scheduling of periodic tasks?
Existence of a Utilization-Based Test
[Liu 1973]EDF
[Bini 2003]RM
(Hyperbolic Bound)
10 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Utilization of a non-preemptive task set which cannot be scheduled by any clairvoyant scheduling algorithm, can be arbitrarily close to zero.
Impossibility of Finding a Utilization-Based Test
2
1/ε
τ2:(2, 1/ε )
…εmissed
1
τ1:(ε, 1)
ε ~0 ⇒ U~0
11 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 11 of 29
It is impossible to find any relation between utilizations such that if it holds, schedulability of any scheduling algorithm is guaranteed.
Impossibility of Finding a Utilization-Based Test
We build an infeasible task set with those utilizations
τ1 to τn-1 :T1 = T1 = … = Tn-1 = an arbitrary valuec1 = u1T1, c2 = u2T2, … , cn-1 = un-1Tn-1
…
c1 + c2 + … + cn-1
T1-cr T1-cr +ε
τn: cn = 2(T1-cr)+ εTn = cn/un cr = c1 + c2 + … + cn-1
cn = 2(T1-cr) +ε
τn
…
c1 + c2 + … + cn-1
τ1 to τn-1
At least one deadline miss
12 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 12 of 29
Yes! (for npEDF)
[Jeffay 1991]: Necessary and sufficient conditions for the schedulability of periodic tasks with unknown release offsets (with npEDF):
Is There Any Necessary & Sufficient Test?
Does it provide necessaryconditions for task sets with known release offset?
13 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
For task sets with no or known release offset, Jeffay’s conditions are only sufficient.
Pessimism in the existing schedulability test
This task set is feasible by npEDF, but it is rejected in Jeffay’s test
14 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 14 of 29
Processor Speedup Approach
ci …τiProcessor
with speed 1
Processor with speed S
ci/S …Ti
τi
[Thekkilakattil 2013]
15 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks15 of 29
The speed S that guarantees the feasibility of a non-preemptive execution of a harmonic task set is upper bounded by
The proof can be done by finding the bound on the maximum possible execution time of a non-preemptive task!
Applying the Existing Speedup Factor (in Harmonic Task Sets)
S ≤ 8It may reduce U=1 to U’=0.125
16 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 16 of 29
Can we find cases where npEDF and npRM are optimal?
Can we find better speedup factor?
We Focus on Harmonic Tasks
17 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks17 of 29
Schedulable and Non-schedulable Tasks
What if the execution times are limited to ci ≤ T1 – c1?
Schedulable!
Non-Schedulable!
18 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 18 of 29
If we have U ≤ 1 and ci ≤T1 – c1 can we guarantee schedulability?
Intuition: maximum blocking will be bounded to T1 – c1
Is it enough?
Is a Task Set with Limited Execution Times, Schedulable with npEDF?
19 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
npRM and npEDF are not optimal for harmonic tasks with U ≤ 1 and ci ≤T1 – c1
Limiting the Execution Times Is Not Enough
This task set is infeasible
The relation between periods cannot be ignored easily!
20 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 20 of 29
We can count the vacant intervalsto make sure each task has its own place to be scheduled!
Next Step: Finding Feasible Cases for npEDF
21 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
A vacant interval is constructed by the slack of τ1
The number of vacant intervals is defined as
Definition of Vacant Intervals
τ3
c3 = T1 – c1
τ1
c1
τ2
c2 = T1 – c1 V2 = 3
V3 = 2
22 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks22 of 29
ci = T1 – c1
npRM and npEDF have no deadline miss if in the harmonic task set we have
U ≤ 1 ci ≤T1 – c1 Vi ≥ 1, 1 < i < n; and Vn ≥ 0
Sufficient Schedulability Conditions for npRM and npEDF
τ3
c1
τ1
τ2
c2 = T1 – c1
c3 = T1 – c1
τi……
ki > 1
23 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 23 of 29
The New Speedup Factor
npEDF and npRM guarantee schedulability if ci ≤T1 – c1 and ki > 1, or
ci ≤T1 – c1 and Vi ≥ 1
[Deogun 1986] ci ≤ 2(T1 – c1) and K ≥ 3
[Cai 1996] ci ≤ 2(T1 – c1) and K = 2 or ki ≥
3
S is bounded to 2
24 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 24 of 29
npEDF and npRM with speedup factor 2 are optimal
for task sets with enough vacant interval orinteger period ratio greater than 1
In ECRTS 2014, we have introduced a framework to construct customized harmonic periods.
It can be used to increase the applicability of our results.
25 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 25 of 29
Experimental Results
26 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Non-preemptive RM (npRM) Precautious-RM (pRM) [Nasri 2014] Cai’s Algorithm (GSSP) [Cai 1996] Group-Based EDF (gEDF) [Li 2007]
npEDF + Speedup Factor of [Thekkilakattil 2013] (TSP-EDF)
npEDF + Our Speedup Factor (OSP-EDF)
Scheduling Algorithms
27 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 27 of 29
Task Sets with ci ≤ 2(T1 – c1)
Task setsci ≤ 2(T1 – c1)Vi ≥ 1ki {1, 2, …, 6}∊Parameter: u1 from 0.1 to 0.9
OSP-EDF, TSP-EDF, and Precautious-RM have no misses.
gEDF has the highest amount of miss ratio. In this case, it is worse than npRM.
The goal is to show the efficiency of the speedup of TSP- and OSP-EDF.
28 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 28 of 29
Conclusion
npEDF
npRM
Negative Results
Non-existence of any utilization-based test
Pessimism in the existing testFor tasks with known release time
Inefficiency of the recent processor speedup approachfor many cases of harmonic tasks
29 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 29 of 29
Conclusion
npEDF
npRM
New Results
Schedulability conditionswith limited execution time
Extending those conditions to task sets with ki > 1
Deriving more efficient speedup factor when the execution time is not limited
30 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 30 of 25A Framework to Construct Customized
Harmonic Periods for RTS
Questions
Thank you
31 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
The speedup factor that guarantees feasibility of npRM and npEDF for task sets with U ≤ 1 and ci ≤ 2(T1 – c1) and
Vi ≥ 1 (for 1 < i < n), and Vn ≥ 0 is bounded to
An Efficient Speedup Factor
S is bounded to 2
32 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
U ≤ 1 ci ≤ 2(T1 – c1)
Necessary Conditions of Schedulability of Non-preemptive Task Sets
We call it the Slack Rule
33 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 33 of 25A Framework to Construct Customized
Harmonic Periods for RTS
We can use a sort of packing in the tasks so that in the formula, each vacant interval can be occupied by different subset of tasks.
We might be able to show that the problem of finding the minimum number of Vis is NP-Complete because it can reduces to subset sum problem.
Future Works
T1- c1
τ1
c1 …
…
c2 + c5 + … + cj
τ2 , τ5 , … , τj …
T2
34 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
[Kim 1980]: Exact schedulability analysis for npEDF [Jeffay 1991]:
◦ Necessary and sufficient conditions for schedulability of npEDF for periodic tasks with unknown release phase
◦ npEDF is optimal among non-work conserving algorithms
[George 1996, Park 2007, Andersson 2009]: Sufficient conditions for RM and FP algorithms
[Marouf 2010]: Schedulability analysis for strictly periodic tasks
Schedulability Analysis for Periodic Tasks
35 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Clairvoyant EDF [Ekelin 2006]◦ It looks ahead in the schedule and tries to …◦ Not optimal
Group-Based EDF [Li 2007]◦ Creates groups of tasks with close deadlines◦ Selects a task with the shortest execution time from a group with the
earliest deadline◦ Efficient for soft real-time tasks◦ Not optimal
Heuristic Algorithms
36 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
General task sets with limited execution time◦ ci ≤ 2(T1 – c1 )
◦ ki {1, 2, …, 6}∊
◦ Parameter: U from 0.1 to 0.9
Experiment Setup
37 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 37 of 29
Task Sets with Limited Execution Times
TSP-EDF is only optimal algorithm (it uses S ≤ 8).
OSP-EDF has in average only 1% miss ratio, however, it cannot guarantee schedulability because of not having Vi ≥ 1 condition.
Precautious-RM is very efficient among other algorithms, yet it is not optimal.
Note: some of those task sets are infeasible.
38 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
General task sets◦ ki {1, 2, …, 6}∊
◦ Parameter: U from 0.1 to 0.9 (with uUniFast)
Experiment Setup
39 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 39 of 29
General Task Sets
TSP-EDF is only optimal algorithm (it uses speedup).
OSP-EDF has in average only 0.02 miss ratio, however, it cannot guarantee schedulability
Precautious-RM is very efficient among other algorithms, yet it is not optimal.
Note: many of those task sets are infeasible.
40 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
Feasible task sets◦ ci ≤ T1 – c1
◦ Vi ≥ 1
◦ ki {1, 2, …, 6}∊
◦ Parameter: u1 from 0.1 to 0.9
Experiment Setup
41 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 41 of 29
Feasible Task Sets
gEDF has a lot of misses.
GSSP cannot handle ki =1
Others have no misses
Before u1=0.5, Cmax is usually from other tasks, after that c1 becomes larger than others
[Thekkilakattil 1013]
42 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks 42 of 29
For the proof we use necessary condition ci ≤ 2(T1 – c1), thus:◦ Cmax is either 2(T1 – c1) or c1
◦ Dmin is T1
The speed S that guarantees the feasibility of a non-preemptive execution of a harmonic task set is upper bounded by
S ≤ 8It may reduce U=1 to U’=0.125
43 of 29On the Optimality of RM and EDF
for Non-preemptive Harmonic Tasks
npRM and npEDF are identical if the period is the tie breaker (for npEDF)
In Harmonic Task Sets
From now on, any result for npRM is applicable on npEDF as well
RM and EDF are also identical