# Lecture 4

Oct 24, 2014

## Documents

#### run termination

Rate Monotonic TheoryECEN 4623/5623 Lecture 4

July 7, 2004

Sam Siewert

RM Assumptions and Constraints A1: All Services Requested on Periodic Basis, the Period is Constant A2: Completion-Time < Period A3: Service Requests are Independent (No Known Phasing) A4: Run-time is Known and Deterministic (WCET may be Used) C1: Deadline = Period by Definition C2: Fixed Priority, Preemptive, Run-to-Completion Scheduling Critical Instant: longest response time for a service occurs when all system services are requested simultaneously (maximum interference case for lowest priority service)

No Other Shared Resources Not in Paper, but key assumption e.g. shared memory Sam Siewert 2

Derivation of RM LUB for 2 TasksClaim - General RM Least Upper Bound: U = (Ci / Ti ) (Guarantees that all Service Releases Can meet Deadlines)i =1 m 1 m( 2 m

1)

Goal - Derive RM LUB For 2 Tasks: U = C1 / T1 + C2 / T2

1 2(2 2

1) 0.83

For a System, Can All Cs fit in largest T over LCM time?Given: Services S1, S2 with periods T1 and T2 and C1 and C2, Assume T2 > T1 E.g. T1=2, T2=5, C1=1, C2= 1, then if prio(S1) > prio(S2), we can see that ...

U = 1 / 2 + 1 / 5 = 0.7

C.I. S1 S2 T2 T1

T2 / T1 C1 + C2 T2

T2 / T1 C1 + C2 T2

U = 0.7 2(2 1) 0.83

1 2

Sam Siewert

3

Can You Safely Exceed LUB?YES! In some cases, but RM LUB will never pass an infeasible systemRM LUB is a SUFFICIENT Feasibility Test RM LUB is NOT a NECESSARY and SUFFICIENT Feasibility Test (Systems with Harmonic Periods can often have U=1.0 and be feasible!)

Example Where RM LUB is Safely Exceeded:Given: Services S1, S2 with periods T1 and T2 and C1 and C2, Assume T2 > T1 E.g. T1=2, T2=5, C1=1, C2= 2, then if prio(S1) > prio(S2), note that:

U = 1 / 2 + 2 / 5 = 0.9U = 0.9 > 2(2 1) U = 0.9 > 0.831 2

C.I. S1 S2 T2 T1

T2 / T1 C1 + C2 T2

T2 / T1 C1 + C2 T2

Sam Siewert

4

RM Priority Assignment PolicyRM Policy:Given: services S1, S2 with periods T1 and T2 and C1 and C2 with T2 > T1 E.g. T1=2, T2=5, C1=1, C2=2, then if prio(S1) > prio(S2), note that:

S1 Makes Deadline if prio(S1) > prio(S2)

S1 S2 T2 T1 Sam Siewert

D1

D1 D2

5

RM Priority Assignment PolicyConsider Alternative Policy:Given: services S1, S2 with periods T1 and T2 and C1 and C2 with T2 > T1 E.g. T1=2, T2=5, C1=1, C2=2, then if prio(S2) > prio(S1), note that:S1 Misses Deadline if prio(S2) > prio(S1)

S1 S2 T2 T1

Conclusion:

If {Sn} feasible with prio(S2) > prio(S1), then {Sn} is also always feasible given prio(S1) > prio(S2), but converse is not necessarily TRUE!! Therefore, prio(S1) > prio(S2) is OPTIMAL Sam Siewert 6

RM LUB DerivationFinding RM Safe Upper Bound (LUB):If system feasible over LCM with RM policy, then by Theorem Two (Briand and Roy), it is safe! Note that there can be up to T2 / T1 releases of S1 during T2! C.I. S1 S2 T2 T1 #1 #2 #3

LUB Derivation Strategy:Case 1: C1 short enough to fit all 3 releases in T2 (fits S2 critical time zone) Case 2: C1 too large to fit last release in T2 (doesnt fit S2 critical time zone) Examine U in both cases to find common U bound. Sam Siewert 7

RM LUB DerivationCase 1 (All 3 C1 releases fit in T2):C1 T2 T1 T2 / T1 C2 = T2 C1 T2 / T1 U= C1 C2 + T1 T2(I.e, C1 is small enough to fit into fractional 3rd T1 shown below as (I.e, C2 = T2 - Interference from C1 releases) )

C.I. S1 S2 T2 T1 #1 #2 #3

Plugging C2 Expression into U: U monotonically decreases with increasing C1 when (T2>T1) Sam Siewert

U=

C1 [T2 C1 T2 / T1 ] + T1 T2

T /T U = 1 + C1 (1 / T1 ) 2 1 T2

8

Proof that U Monotonically Decreases in Case-1Value of Maximum Occurances of Period-1 During Period-2 Over Period-21.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1 1 2 3 4 5 6 7 8

T2

Sam Siewert

9

RM LUB DerivationCase 2 (Last C1 release does not fit in T2):C.I.C1 T2 T1 T2 / T1 C2 = T1 T2 / T1 C1 T2 / T1 U= C1 C2 + T1 T2

S1 S2 T2 T1

#1

#2

#3

Plugging C2 Expression into U: U monotonically increases with increasing C1 when (T2>T1) Sam Siewert

U=

C1 [T1 T2 / T1 C1 T2 / T1 ] + T1 T2

U = (T1 / T2 )T2 / T1 + C1 [(1 / T1 ) (1 / T2 )T2 / T1 ]10

RM LUB DerivationGiven Cases 1 and 2 (T1=2, T2=5)Case 1C1 T2 T1 T2 / T1 C2 = T2 C1 T2 / T1 U= C1 C2 + T1 T2

IntersectionC1 = T2 T1 T2 / T1 C2 = T1 T2 / T1 C1 T2 / T1 U= C1 C2 + T1 T2

Case 2C1 T2 T1 T2 / T1 C2 = T1 T2 / T1 C1 T2 / T1 U= C1 C2 + T1 T2

T1= Case 1 C1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

U

1.0 U

2 T2= Case C1 1 0.99 0.98 0.97 0.96 0.95 0.94 0.93 0.92 0.91 0.9

5 2 U 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9

LUB =?C1U = (T1 / T2 )T2 / T1 + C1 [(1 / T1 ) (1 / T2 )T2 / T1 ] T /T U = 1 + C1 (1 / T1 ) 2 1 T2

Case 1: Case 2:

Note: we want the LUB for any given T2 and T1, not the ones assumed here in particular, so the general LUB could be something other than 0.9, and must be found in terms of T1 and T2 only for general LUB.11

Sam Siewert

RM LUB DerivationIntersection of Case 1 & 2 is Least Upper BoundPlug In Intersection for C1 and C2 into U to get expression in terms of T1 and T2 only: U = 1 (T1 / T2 )[T2 / T1 (T2 / T1 )][(T2 / T1 ) T2 / T1 ] (Substitute for both C1 and C2 in U expression and simplify) f (1 f ) Let I = T2 /T1 and f = (T2 / T1 ) T2 / T1 so, U = 1 ( ) T2 / T1

I is the integer number of times that T1 occurs during T2 f is the fractional time of the last release for T1 during T2, noting that if f =0, then T1 and T2 are harmonic, and therefore U=1, an uninteresting ideal case. Substituting I and f into the U expression above and simplifying, we get:U = 1 (T1 / T2 )[T2 / T1 (T2 / T1 )][(T2 / T1 ) T2 / T1 ]

U = 1 (T1 / T2 )[1 ((T2 / T1 ) T2 / T1 )][(T2 / T1 ) T2 / T1 ]

U = 1 (T1 / T2 )[1 + T2 / T1 (T2 / T1 )][(T2 / T1 ) T2 / T1 ]

(noting that 1+floor(N+/-0.d) = ceiling(N+/-0.d) when f non-zero)

So, U = 1 (T1 / T2 )(1 f )( f ) , Re-arranged to obtain: U = 1 Sam Siewert

f (1 f ) (T2 / T1 )

12

RM LUB Derivation f (1 f ) U = 1 (T / T ) 2 1

Can also be expressed as: By adding and subtracting the same denominator term to get: f f2 U = 1 (1 + f )

f (1 f ) U = 1 T / T + (T / T ) T / T 2 1 2 1 2 1

f (1 f ) smallest I is 1, and LUB for U U = 1 (I + f ) occurs when I is minimized, so:

(

)

Now taking the derivative of U w.r.t. f, and solving for extreme, we get:dU / df

And, plugging f back into U, we get: U = 2(21/ 2 1) The RM LUB! Sam Siewert 13

Solving for f, we get: f = (21/ 2 1)

(1 + f )(1 2 f ) ( f = (1 + f )2

f 2 (1)

)

=0

RM LUB Scenario for 2 Services(With T1=2, T2=3, We Show U=0.83 Worst-Case Graphically)Given Case 1: U = (T1 / T2 )T2 / T1 + C1 [(1 / T1 ) (1 / T2 )T2 / T1 ] And Case 2: U = 1 + C1 (1 / T1 ) T2 / T1 T2 1 0.95 0.9 0.85 0.8 0.75 0.7 0.65 0.6 0.55 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 0 0.5 C1 1 1.5T1= Case 1 C1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 2 U 1 0.983333 0.966667 0.95 0.933333 0.916667 0.9 0.883333 0.866667 0.85 0.833333 0.816667 0.8 0.783333 0.766667 0.75 C2 3 2.8 2.6 2.4 2.2 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 T2= Case 2 C1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 3 U C2 0.666667 0.683333 0.7 0.716667 0.733333 0.75 0.766667 0.783333 0.8 0.816667 0.833333 0.85 0.866667 0.883333 0.9 0.916667

RM LUB (T 1 =2, T 2 =3)

2 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1 0.9 0.8 0.7 0.6 0.5

Sam Siewert

U

14

RM LUB Scenario for 2 Services(Showing U=0.83 Worst-Case Timing Diagram)

Given Cases 1 and 2 again:T1=2, T2=3, C1=1, C2=1 at U=0.83 Note: 5 out of 6 Time Units Used Over LCM Such That U=0.83, the RM LUB!C.I. S1 S2 T2 T1 Sam Siewert 15

RM FAQ Where in the paper does it say that T must equal D? T=D is in section 4 above Theorem 1 in Liu and Layland paper

Why does Floor(x.d)+1 = Ceiling(x.d)?, because if x=1 or any integer, this is not true. Floor(x.d) + 1 = Ceiling(x.d) iff x is not an integer value, which is always true if T2 is not a multiple of T1

If T2 > T1, but T2 is a multiple of T1 (if T1 and T2 are harmonic), then U=1, and doesnt this violate the RM LUB? Yes, it does, but remember the RM LUB is only sufficient, not N&S, and therefore it will pessimistically fail service sets that can actually be scheduled The RM LUB will correctly fail all service sets than in fact cant be scheduled, so it is sufficient

Why Not Just Use EDF Scheduling Policy if it Can Achieve 100% Utility and Be Shown to Meet Deadlines? What Happens When EDF is Overloaded? Sam Siewert 16

Dynamic Priority Issues Earliest Deadline First Policy (aka Deadline Driven Scheduling) Can Be High Overhead - Every time the Ready Queue is Updated, the Scheduler Must Re-assign all Priorities According to Each Services Time Remaining to Deadline and Perform a Priority Preemption. Overload Failure Modes Non-Deterministic - In an Overload Scenario, EDF Can Have Difficult to Predict and Cascading Multi-Service Failures Overload with RM Policy is Deterministic - the Lowest Priority Service Will Fail First and The Number of Services Failing From Lowest Priority Up Can be Determined by Duration of Over-run and Priority of Over-running Service Over-run Interference Has Known Impact on Lower Priority Serv

Related Documents See more >
##### Lecture 4: Sexual Selection & Differential...
Category: Documents
##### ¨³… §„„‡ §„±­…† §„±­… Lecture( 4)
Category: Documents