Software Synthesis part-II
-
Upload
nathaniel-brock -
Category
Documents
-
view
51 -
download
0
description
Transcript of Software Synthesis part-II
![Page 1: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/1.jpg)
Software Synthesis part-II
![Page 2: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/2.jpg)
Course Overview
www.chyon.wikispaces.com
Embedded System EngineeringA.S.M Mostafizur Rahaman
Mapping Spec → SW by Software Scheduling
– Static scheduling
– Rate monotonic scheduling (RMS)
– Inverse deadline scheduling (IDS)
– Earliest deadline first scheduling (EDF)
– Non-periodic tasks
Software estimation
– Timing estimation by program path analysis
– Architecture modelling
– Statistical techniques for program analysis
![Page 3: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/3.jpg)
Scheduling Characteristics
Sufficient – pass the test will meet deadlines Necessary – fail the test will miss deadlines
Exact – necessary and sufficient
Sustainable – system stays schedulable if conditions ‘improve’
![Page 4: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/4.jpg)
Simple Task Model
The application is assumed to consist of a fixed set of tasks All tasks are periodic, with known periods The tasks are completely independent of each other All system's overheads, context-switching times and so on are
ignored (i.e, assumed to have zero cost) All tasks have a deadline equal to their period (that is, each task
must complete before it is next released) All tasks have a fixed worst-case execution time
![Page 5: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/5.jpg)
Rate Monotonic Priority Assignment
Each task is assigned a (unique) priority based on its period; the shorter the period, the higher the priority
i.e, for two tasks i and j,
This assignment is optimal in the sense that if any task set can be scheduled (using pre-emptive priority-based scheduling) with a fixed-priority assignment scheme, then the given task set can also be scheduled with a rate monotonic assignment scheme
Note, priority 1 is the lowest (least) priority
P jPiT jT i
![Page 6: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/6.jpg)
Example Priority Assignment
Process Period, T Priority, Pa 25 5 b 60 3 c 42 4 d 105 1e 75 2
![Page 7: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/7.jpg)
Utilization-Based Analysis
For D=T task sets only A simple sufficient but not necessary schedulability test exists
)12( /1
1
NN
i i
i NT
CU
NU as 69.0
![Page 8: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/8.jpg)
Utilization Bounds
N Utilization bound 1 100.0%2 82.8%3 78.0%4 75.7% 5 74.3%
10 71.8%
Approaches 69.3% asymptotically
![Page 9: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/9.jpg)
Task Period ComputationTime Priority Utilization T C P U
a 50 12 1 0.24 b 40 10 2 0.25 c 30 10 3 0.33
Task Set A
The combined utilization is 0.82 (or 82%) This is above the threshold for three tasks (0.78) and, hence,
this task set fails the utilization test
![Page 10: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/10.jpg)
Time-line for task Set A
0 10 20 30 40 50 60
Time
task
a
b
c
Task Release Time
Task Completion TimeDeadline Met
Task Completion TimeDeadline Missed
Executing
Preempted
![Page 11: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/11.jpg)
Task Period ComputationTime Priority Utilization T C P U
a 80 32 1 0.400 b 40 5 2 0.125 c 16 4 3 0.250
Task Set B
The combined utilization is 0.775 This is below the threshold for three tasks (0.78) and, hence,
this task set will meet all its deadlines
![Page 12: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/12.jpg)
Task Period ComputationTime Priority Utilization T C P U
a 80 40 1 0.50 b 40 10 2 0.25 c 20 5 3 0.25
Task Set C
The combined utilization is 1.0 This is above the threshold for three tasks (0.78) but the task
set will meet all its deadlines
![Page 13: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/13.jpg)
Time-line for Task Set C
0 10 20 30 40 50 60
Time
task
a
b
c
70 80
![Page 14: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/14.jpg)
Response-Time Analysis
Here task i's worst-case response time, R, is calculated first and then checked (trivially) with its deadline
Where I is the interference from higher priority tasks
iii ICR ii DR
![Page 15: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/15.jpg)
Calculating R
During R, each higher priority task j will execute a number of times:
j
i
T
R ReleasesofNumber
Total interference is given by:
jj
i CT
R
The ceiling function gives the smallest integer greater than the fractional number on which it acts. So the ceiling of 1/3 is 1, of 6/5 is 2, and of 6/3 is 2.
![Page 16: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/16.jpg)
Response Time Equation
jihpj
j
iii C
T
RCR
)(
Where hp(i) is the set of tasks with priority higher than task i
Solve by forming a recurrence relationship:
jihpj
j
n
ii
n
i CTw
Cw
)(
1
The set of values is monotonically non decreasing.When the solution to the equation has been found; must not be greater that (e.g. 0 or )
1 n
i
n
i ww,..,...,,, 210 n
iiii wwww0
iw
iR iC
![Page 17: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/17.jpg)
Response Time Algorithm
for i in 1..N loop -- for each process in turn n := 0
loop calculate new if then exit value found end if if then exit value not found end if n := n + 1 end loopend loop
i
n
i Cw :
1n
iwn
i
n
i ww 1
n
ii wR
i
n
i Tw 1
![Page 18: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/18.jpg)
Task Period ComputationTime Priority T C P a 7 3 3 b 12 3 2 c 20 5 1
Task Set D
3aR
6
637
63
637
33
3
2
1
0
b
b
b
b
R
w
w
w
![Page 19: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/19.jpg)
17312
143
7
145
14312
113
7
115
11312
53
7
55
5
3
2
1
0
c
c
c
c
w
w
w
w
20
20312
203
7
205
20312
173
7
175
5
4
c
c
c
R
w
w
![Page 20: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/20.jpg)
Process Period ComputationTime Priority Response time T C P R
a 80 40 1 80 b 40 10 2 15 c 20 5 3 5
Revisit: Task Set C
The combined utilization is 1.0 This was above the utilization threshold for three tasks (0.78),
therefore it failed the test The response time analysis shows that the task set will meet
all its deadlines
![Page 21: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/21.jpg)
Response Time Analysis
Is sufficient and necessary (exact) If the task set passes the test they will meet all their
deadlines; if they fail the test then, at run-time, a task will miss its deadline (unless the computation time estimations themselves turn out to be pessimistic)
![Page 22: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/22.jpg)
Task Sets with D < T: Deadline monotonoic
For D = T, Rate Monotonic priority ordering is optimal For D < T, Deadline Monotonic priority ordering is
optimal
jiji PPDD
![Page 23: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/23.jpg)
Task Period Deadline ComputationTime Priority Response time T D C P R
a 20 5 3 4 3 b 15 7 3 3 6 c 10 10 4 2 10 d 20 20 3 1 20
D < T Example Task Set
![Page 24: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/24.jpg)
EDF Scheduling
Always run task with earliest absolute deadline Will consider
Utilization based tests
![Page 25: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/25.jpg)
11
N
ii
i
TC
Utilization-based Test for EDF
Superior to FPS (0.69 bound in worst-case); it can support high utilizations. However,
Bound only applicable to simple task model Although EDF is always as good as FPS, and usually better
A much simpler test than that for FPS
![Page 26: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/26.jpg)
FPS v EDF
FPS is easier to implement as priorities are static EDF is dynamic and requires a more complex run-time
system which will have higher overhead It is easier to incorporate tasks without deadlines into FPS;
giving a task an arbitrary deadline is more artificial It is easier to incorporate other factors into the notion of
priority than it is into the notion of deadline
![Page 27: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/27.jpg)
FPS v EDF
During overload situations FPS is more predictable; Low priority process miss their deadlines
first EDF is unpredictable; a domino effect can occur in which a large
number of processes miss deadlines But EDF gets more out of the processor!
![Page 28: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/28.jpg)
Aperiodic Tasks
These do not have minimum inter-arrival times Can run aperiodic tasks at a priority below the priorities
assigned to hard processes, therefore, they cannot steal, in a pre-emptive system, resources from the hard processes
This does not provide adequate support to soft tasks which will often miss their deadlines
To improve the situation for soft tasks, a server can be employed
![Page 29: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/29.jpg)
Execution-time Servers
A server: Has a capacity/budget of C that is available to its client tasks
(typically aperiodic tasks) When a client runs it uses up the budget The server has a replenishment policy If there is currently no budget then clients do not run Hence it protects other tasks from excessive aperiodic activity
![Page 30: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/30.jpg)
Periodic Server (PS)
Budget C Replenishment Period T, starting at say 0 Client ready to run at time 0 (or T, 2T etc) runs while
budget available, is then suspended Budget ‘idles away’ if no clients
![Page 31: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/31.jpg)
Deferrable Server (DS)
Budget C Period T – replenished every T time units (back to C)
For example 10ms every 50ms Anytime budget available clients can execute Client suspended when budget exhausted DS and SS are referred to as bandwidth preserving
Retain capacity as long as possible PS is not bandwidth preserving
![Page 32: Software Synthesis part-II](https://reader030.fdocuments.net/reader030/viewer/2022032708/56812ae5550346895d8ecbb2/html5/thumbnails/32.jpg)
Sporadic Server (SS)
Initially defined to enforce minimum separation for sporadic tasks
Parameters C and T Request at time t (for a < C) is accepted
a is returned to server at time t+T Request at time t (for 2C>A>C):
C available immediately Replenished at time t+T Remainder (2C-A) available at this time