Task model Real-Time Task Slack and Lateness Tasks and jobs

Transcript

Task model Real-Time Task Slack and Lateness Tasks and jobs
Slack and Lateness
Di
i
ai
si
fi
Ri
slacki = di - fi
lateness Li = fi - di
Di
i
si
ai
t
di
di
fi
t
Ri
Task model
Tasks and jobs
 Sequence of instructions that in the absence of
other activities is continuously executed by the
processor until completion.
Task i
activation time
A task running several times on different input
data generates a sequence of instances (jobs):
Ci
start time
ai
computation
time
si
fi
t
Response time Ri
Job 1
Job 2
Job 3
i,1
i,2
i,3
Ci
i
ai,1
ai,k
ai,k+1
t
finishing time
Real-Time Task
 It is a task characterized by a timing constraint on
its response time, called deadline:
ai
si
response time Ri
 Time driven
The task is automatically activated by the
operating system at predefined time instants.
relative deadline Di
i
Activation modes
fi
t
di
absolute deadline
(di = ai + Di)
 Event driven
The task is activated at an event arrival or by
explicitly invocating a system call.
A real-time task i is said to be feasible if it
completes within its absolute deadline, that is,
if fi  di, o equivalently, if Ri  Di
1
Types of tasks
Assumptions
 Aperiodic
Activated by events. Task activation times are
unknown and unbounded.
 Implicit deadlines
 Sporadic
Activated by events.
events Task activation times are
unknown and bounded: consecutive activations are
separated by a minimum interarrival time.
 Constrained deadlines
 Periodic
Activated by a timer. Task activation times are
known and bounded: Consecutive jobs are
separated by a constant interval (period).
 Arbitrary deadlines
i
Di = Ti
i
Di ≤ Ti
Deadlines can be less than,
greater than, or equal to periods
Analysis under fixed priority
Aperiodic/Sporadic task
interrupt
Let  = {1, …, n} be a set of n periodic tasks.
Ci computation time
Implicit deadlines
job ik
Ci
i
Ci
…
ai,1
Ci
ai,k
t
ai,k+1
 Aperiodic: (Ci, Di)
n
Utilization-based test
[Liu & Layland, 1973]
U
i 1
ai,k+1 > ai,k
 Sporadic: (Ci, Di, Ti)
Hyperbolic Bound
[Bini - Buttazzo2, 2001]
ai,k+1  ai,k + Ti
i


 n 21/ n  1
n
 U
i
 1  2
i 1
only
sufficient
only
sufficient
minimum
interarrival time
11
Analysis under fixed priority
Periodic task
input
Constrained deadlines
Ci
output
C
Ui = i
Ti
computation time
timer (period Ti )
sync
jjob ik
Ti
i
Response Time Analysis
[Audsley et al., 1993]
utilization factor
ai,k
ai,k+1
task phase
i (i , Ci, Ti, Di )
necessary
and
sufficient
Iterative solution:
Ci
ai,1 = i
i Ri  Di
ai,k = i + (k1) Ti
di,k = ai,k + Di
t
Ri( 0 ) 
(s)
i
R
i
C
k 1
k
i 1
 Ci  
k 1
Ri( s 1)
Ck
Tk
iterate while
Ri( s )  Ri( s 1)
12
2
Analysis under EDF
Workload Analysis under FP
Constrained deadlines
Processor Demand
[Baruah et al., 1990]
Arbitrary deadlines
necessary
and
sufficient
 t D dbf (t)  t
 dbf(t) is called demand bound function and denotes the
computation time of tasks with deadlines ≤ t
n
t + Ti  Di
dbf (t) =
Ck
Ti
i=1
Σ
 D is the set of points where the test has to be performed
D = {dk | dk  Lb}
Lb = max{Dmax, min(H, L*)}
L* 
H = lcm(T1, … , Tn)

n
i 1
Ci
1
3
2
1
2
3
Ti
4
6
14
Di
2
5
9
Ti - Di
2
1
5
Ui
1/4
1/2
1/7
i–1
Wi (t) = Ci +
Σ
k=1
t
C
Tk k
13
16
U 
Workload Analysis under FP
1 1 1 25
  
4 2 7 28
1
1
2
5
H = 437 = 84
A task i is feasible iff:
 t ≤ Di : Wi(t) ≤ t
W2(t)
18
2 1 5
n
 
(T  Di )U i
12 28

*
i 1 i
L 
 4 2 7 

 16
3
1U
7 3
28
16
14
12
10
8
6
Lb = max (9, min(84,16)) = 16
Dmax = 9
necessary
and
sufficient
 Wi (t) is called workload in (0, t] at priority level Pi and
denotes the computation time requested in (0,
(0 t] by tasks
with priority higher than or equal to Pi
EDF example
task
i  t  Ai Wi (t)  t
 Ai is the set of points where the test has to be performed,
equal to the activation times ≤ Di, including Di
(Ti  Di )U i
1U
Workload Analysis
[Lehoczky et al., 1989]
4
2
0
D = {dk | dk  Lb} = {2, 5, 6, 9, 10, 11, 14}
0
2
4
6
8
10
12
14
16
18
20
14
17
EDF example
Workload Analysis under FP
1
1
1
1
2
3
2
7
3
2
9
dbf(t)
()
16
14
23
A task i is feasible iff:
 t ≤ Di : Wi(t) ≤ t
W2(t)
18
16
14
14
12
12
10
10
8
8
6
6
4
4
2
2
0
0
0
2
4
6
8
10
12
14
16
Lb
18
20
22
24
0
15
2
4
6
8
10
12
14
16
18
20
18
3
Workload Analysis under FP
1
3
2
2
Workload Analysis under FP
A task i is feasible iff:
1
1
 t ≤ Di : Wi(t) ≤ t
2
3
3
2
W2(t)
18
16
16
14
14
12
12
10
10
8
8
6
6
4
4
2
miss
9
W3((t))
14
23
2
0
0
0
2
4
6
8
10
12
14
16
18
20
0
2
4
6
8
10
19
Workload Analysis under FP
1
1
2
3
3
2
14
16
18
20
22
Workload Analysis under FP
Theorem [Bini-Buttazzo, 2002]
AND
OR
A task set is feasible under fixed priorities iff:
miss
9
W3((t))
16
12
A3 = {4, 6, 8, 9}
14
i = 1...n t  Pi–1(Di)
23
14
Wi (t) ≤ t
Where Pi(t) is defined by:
12
10
8
P0(t) = { t }
In an unfeasible schedule:
6
 t ≤ Di : Wi(t) ≤ t
4
2
Pi(t) = Pi-1
0
0
2
4
6
8
10
12
14
16
18
t
Ti
U Pi-1(t)
Ti
20
20
23
Workload Analysis under FP
Example
1
Theorem [Lehoczky-Sha-Ding, 1989]
2
A task set is feasible under fixed priorities iff:
3
9
12
15
8
3
 i = 1…n  t ≤ Di : Wi (t) ≤ t
6
18
21
16
24
20
1
Problem
How many points need to be tested?
When checking i feasibility, we need to verify W(t) ≤ t for Di
and for all release times rhk ≤ Di of jobs hk with priority Ph ≥ Pi,
that is, for all t in Ai:
Ai = rhk rhk = kTh, h = 1... i, k = 1... Ti
U Di
Th
21
1: P0(D1) = P0(3) = {3}
P0(t) = { t }
Pi(t) = Pi-1
t
Ti
Ti
U Pi-1(t)
2: P1(D2) = P0(6) U P0(8) = {6, 8}
3: P2(D3) = P1(16) U P1(20)
= [P0(15) U P0(16)] U [P0(18) U P0(20)]
= {15, 16, 18, 20}
24
4
Example
Example
1
2
3
6
9
12
15
8
3
18
1
21
16
2
24
3
20
2
P0(t) = { t }
Pi(t) = Pi-1
1: P0(D1) = P0(3) = {3}
t
Ti
Ti
U Pi-1(t)
N
N
N Y
N
N
Y N
1
2
2: P1(D2) = P0(6) U P0(8) = {6, 8}
3
3: P2(D3) = P1(16) U P1(20)
= [P0(15) U P0(16)] U [P0(18) U P0(20)]
= {15, 16, 18, 20}
25
28
Example
Example
1
2
3
6
9
12
15
8
3
18
16
P0(t) = { t }
Pi(t) = Pi-1
2
24
20
1: P0(D1) = P0(3) = {3}
1
21
t
Ti
3
3
Ti
U Pi-1(t)
N
Y
N N
Y
N
N N
1
2
2: P1(D2) = P0(6) U P0(8) = {6, 8}
3
3: P2(D3) = P1(16) U P1(20)
= [P0(15) U P0(16)] U [P0(18) U P0(20)]
= {15, 16, 18, 20}
26
Workload Analysis under FP
29
Workload Analysis under FP
1
1
2
2
t1
3
i = 1...n t  Pi–1(Di)
P2(D3)
i=1
Pi-1(Di) is the minimum set of points
for checking the feasibility of i.
Wi((t)) ≤ t
C1 ≤ T1
C2 +
t1
C ≤ t1
T1 1
C2 +
t2
C ≤ t2
T1 1
i=2
27
t2
C2 + 2C1 ≤ 2 T1
C2 + 3C1 ≤ T2
30
5
Workload Analysis under FP
C2
C2 + 3C1 ≤ T2
T2
FT1
C2 + 2C1 ≤ 2T1
T2 – FT1
T2
F+1
C1
T1
31
Workload Analysis under FP
C2
C2 + (F+1)C1 ≤ T2
T2
OR
FT1
C2 + FC1 ≤ FT1
T2 – FT1
T2
F+1
C1
T1
32
Analysis summary
Under EDF (Processor Demand Criterion):
 t D
n
dbf (t) =
Σ
i=1
dbf (t)  t
t + Ti  Di
Ck
Ti
Under Fixed Priorities (Workload Analysis):
i  1,..., n
 t  Ai : Wi (t )  t
i–1
Wi (t) = Ci +
Σ
k=1
t
C
Tk k
6