Constant Utilization and Total Bandwidth Servers Total Bandwidth Servers
郭大維 教授 郭大維 教授
嵌入式系統暨無線網路實驗室
(Embedded Systems and Wireless Networking Laboratory)
( y g y)
國立臺灣大學資訊工程學系
All Rights Reserved; Tei-Wei Kuo, National Taiwan University Source: Jane W.S. Liu, “Real-Time Systems,” Prentice Hall, 2000.
Schedulability of Sporadic Jobs in Deadline Driven Systems
Deadline-Driven Systems
• Definition Revisiting: g
– Tasks versus Jobs
– Earliest Deadline First (EDF) Scheduling( ) g
• Definition: The density of a sporadic job with an arrival time ri maximum execution time ei and arrival time ri, maximum execution time ei, and the absolute deadline di is ei
/(d
i-r
i).
• Definition: A job is active in its interval (r d ]
• Definition: A job is active in its interval (ri,di].
• Theorem 7.4 [Jane Liu, RTS2000] A system of
i d d t t bl di j b i
independent preemptable sporadic jobs is schedulable by EDF if the total density of all
ti j b i t th 1 t ll ti
active jobs is no greater than 1 at all times.
(A sufficient condition)
Schedulability of Sporadic Jobs in Deadline Driven Systems
Deadline-Driven Systems
• Definition: The instantaneous utilization of a
• Definition: The instantaneous utilization of a sporadic job Si,jis ui,j= ei,j / pi,j, where pi,j denotes the release-time difference between S and S
the release-time difference between Si,jand Si,j+1.
• Definition: The instantaneous utilization of a sporadic task S is u = max (e / p )
sporadic task Si is ui = maxj(ei,j / pi,j).
• Corollary 7.5 [Jane Liu, RTS2000] A system of n
i d d bl di k i
independent preemptable sporadic tasks is schedulable by EDF if the total instantaneous
tili ti
f ll ti j b i t th 1utilization of all active jobs is no greater than 1,
where the relative deadline of every job is equalt it i d (i th l ti diff )
to its period (i.e., the release-time difference).
(An extension to the considerations of periodic tasks)
Constant Utilization Server
• A constant utilization server is defined by its instantaneous utilization u
s, where the scheduling of instantaneous utilization u
s, where the scheduling of periodic tasks and servers is done by EDF.
– Consumption Rule: A server consumes its budget onlyCo su pt o u e se e co su es ts budget o y when it executes for some sporadic job.
– Replenishment Rule: (es: budget; d: deadline)
1) Initially, es=0 and d=0.
2) When a sporadic job with execution time e arrives at time t to an empty queue
an empty queue,
a) If t < d, do nothing; otherwise, d = t + e/us, and es=e.
3) At the deadline d of the server,) ,
a) If the server is backlogged, set the server deadline to d + e/us, and es=e.
b) If th i idl d thi
b) If the server is idle, do nothing
• A constant utilization server is always given enough budget to complete the job at its queue head each time its budget is replenished.
Constant Utilization Server
• A1: d=3+1.0/0.25=7; A2: At 7, d=7+2/0.25=15; A3: d=23.5
* There is no deadline missing for all periodic tasks if the total size of constant bandwidth servers is no larger than (1-Δ) if Δ is the total density (ei/min(di,pi)) of periodic tasks.
Total Bandwidth Server
• Motivation: Improve a constant utilization server by allowing a server to claim the unused by allowing a server to claim the unused background time.
C ti R l A it b d t l
– Consumption Rule: A server consumes its budget only when it executes for some sporadic job.
Replenishment Rule: (e : budget; d: deadline) – Replenishment Rule: (es: budget; d: deadline)
1) Initially, es=0 and d=0.
2) When a sporadic job with execution time e arrives at time t to 2) When a sporadic job with execution time e arrives at time t to
an empty queue, set d to max(d,t) + e/us, and es=e.
3) When the server completes the current aperiodic job, the job is removed from the queue
is removed from the queue.
a) If the server is backlogged, set the server deadline to d + e/uss, and ess=e.
b) If the server is idle, do nothing
Total Bandwidth Server
• A1: d=3+1.0/0.25=7; A2: At 7, d=7+2/0.25=15; A3 now arrives at 14.
At 14, the d is 15, and the new d = 23.5. A3 completes at 17.5,
i t d f 19 b A3 th idl i (14 15)
instead of 19 because A3 now uses the processor was idle in (14,15).
14
Total Bandwidth Server
• Corollary 7.7 [Jane Liu, RTS2000] When a system of independent preemptable periodic tasks is schedulable with independent, preemptable periodic tasks is schedulable with one or more total bandwidth and constant utilization servers on the EDF basis, every periodic task and every server meets its deadline if the sum of the total density of periodic tasks and the total size of all servers is no greater than 1.
C ll 7 8 [J Li RTS2000] Wh t f
• Corollary 7.8 [Jane Liu, RTS2000] When a system of independent, preemptable periodic tasks is schedulable with one or more total bandwidth and constant utilization servers one or more total bandwidth and constant utilization servers on the EDF basis, every periodic task and every server meets its deadline if the sum of the total density of periodic tasks and the total size of all servers is no greater than 1 – bmax(np)/Dmin, where bmax(np) and Dmindenote the maximum nonpreemptable duration and the min(relative deadlines nonpreemptable duration and the min(relative deadlines, sporadic job execution time), respectively.
Fairness and Starvation
• Fairness: The fraction time of the processor time in the interval attained by each server that is in the interval attained by each server that is backlogged throughout the interval is proportional to the server size
to the server size.
– Total bandwidth servers could be unfair:
• The size of TB1/TB2 is 0.5;
• TB1 remains backlogged in (0, t), but TB2 is idle.
B t TB1 h t d f t ti it d it d dli
• By t, TB1 have executed for t time units, and its deadline is at least 2t.
• Between t and 2t jobs with execution time less than tBetween t and 2t, jobs with execution time less than t arrives and keep TB backlogged; The deadline of TB2 is less than TB1
• As a result, it is unfair in (t,2t) even though it is fair in (0,t), where t can be any number.
Fairness and Starvation
• Fairness Revisiting: The fraction time of the processor time in the interval attained by each processor time in the interval attained by each server that is backlogged throughout the interval is proportional to the server size
is proportional to the server size.
– A scheduler is fair in the interval (t1, t2) if the li d i (t t )/ tt i d b ll normalized service wi(t1,t2)/ui attained by all servers that are backlogged during the interval
diff th th f i th h ld
differ no more than the fairness threshold FR>=0, where wi(t1,t2) is the attained service ti f th i th
time of the i-th server.
i
i
t t u
w
( 1, 2 )Id ll Or w (t t ) = u (t t )
j i j
i
u t
t
w
=) , ( 1 2
2
Ideally, 1 Or, wi(t1,t2) = ui (t2-t1)
Fairness and Starvation
• Why Starvation?
It i b th b k d ti i d
– It is because the background time is made available to some total bandwidth server, e.g.,
TB1 It i l th diff b t t t l
TB1 - It is also the difference between total bandwidth servers and constant bandwidth servers.
• An observation: The current deadline of a constant bandwidth server of size ui is never more than (max ei)/ui. In other words, the length of starvation suffered by any server is bounded by maxi((max ei)/ui).
Fairness and Starvation
• Example: u1=1/4; u2=1/8; u3=1/4; u4=3/8;
Fi t i l A1(t 0 1) A2(0 1) A3(0 3) A4(18 3) – First arrival: A1(t=0,e=1); A2(0,1); A3(0,3); A4(18, 3) – Have servers kept backlogged continuously.
At 18 th d dli f TB1 TB2 d TB3 36 40 – At 18, the deadlines of TB1, TB2, and TB3 are 36, 40,
36, respectively, and they share the 18-unit service time non-proportional to their sizes (i e 8 4 and 6) time non-proportional to their sizes (i.e., 8, 4, and 6).
Fairness and Starvation
• Example: u1=1/4; u2=1/8; u3=1/4; u4=3/8;
Fi t i l A1(t 0 1) A2(0 1) A3(0 3) A4(18 3) – First arrival: A1(t=0,e=1); A2(0,1); A3(0,3); A4(18, 3) – Have servers kept backlogged continuously.
Aft 18 th li d i f ll
– After 18, the normalized services of all servers are identical in time intervals of length 24 or more. Before 18, CU1 CU2 and CU3 executes for 6 3 and 9 units CU1, CU2, and CU3 executes for 6, 3, and 9 units, respectively. Æ No starvation and no fairness guarantee