Post on 13-Dec-2015
Real Time Systems
Real-Time Schedulability
Part I
Schedulability (part 1) - 2
Outline
Timing Requirements
Concurrency and Scheduling
Scheduling Schemes
Notation
Rate Monotonic Algorithm
Utilization Bound Theorem
Examples
Schedulability (part 1) - 3
Timing Requirements
Where do timing requirements come from? Top-level (explicit) Requirements
assemble two widgets every second jam a hostile emitter within 250 milliseconds of it being
identified
Derived (implicit) Requirements precision: track emitter position to within 5°
leads to periodicity dependability: recover from message loss within 500
msec user-interface: respond to key press within 200 msec
Schedulability (part 1) - 4
Concurrency and Scheduling
concurrent systems are said to exhibit extreme non-determinism consider a simple 5 task concurrent system there are 120 possible execution permutations
for a non-preemptive system and an infinite number for a preemptive system
real-time systems must restrict this non-determinism via scheduling
define schedulability as the assessment as to whether tasks will meet their deadlines
Schedulability (part 1) - 5
Scheduling Schemes
a scheduling scheme provides: an algorithm for the use of system resources a way of predicting the worst case behaviour
there are two classifications of schemes static (compile-time) and dynamic (run-time)
we will only study static schemes and in particular, preemptive priority-based schemes
schemes involve: a priority assignment algorithm; and a schedulability test
Schedulability (part 1) - 6
Notation
C: worst-case computation time of the task T: minimum time between task releases
(period) P: priority assigned to the task N: number of tasks in the system R: worst-case response time of the task B: worst-case blocking time of the task I: interference time of the task
Define Utilization: U = C/T
Schedulability (part 1) - 7
Define a Simple Task Model
Assumptions: fixed set of tasks all tasks are periodic tasks are completely independent* all system overheads (context switching) are
ignored (or included in task computation times) task deadlines are equal to their periods
implies that tasks must complete before next release all tasks have a fixed worst-case execution time
Critical instant - defined as the maximum load condition when all tasks release together
Schedulability (part 1) - 8
Rate Monotonic Algorithm (RMA)
a priority assignment scheme for the simple task model described above such that: each task is assigned a priority based upon its
period, wherein the shorter the period, the higher the priority
Example:Task Period (T) Priority (P) A 100 3 B 25 1*
highest C 205 4 D 60 2
Schedulability (part 1) - 9
Utilization Bound Theorem
a set of N independent periodic tasks scheduled by the rate monotonic algorithm will always meet its deadlines, ifC1/T1 + … CN/TN N(2 1/N - 1) = URM(N)
URM(N) converges to 69% at large N
a sufficient but not necessary test i.e. we cannot say that a system with higher utilization is
not schedulable with this scheduling algorithm
Schedulability (part 1) - 10
RMA Example 1
Task Ci Ti Ui
A 20 100 0.2 B 30 150 0.2
C 60 200 0.3
U1 + U2 + U3 = 0.7, and is URM(3)
where URM(3) = 3*(21/3 - 1) = 0.779
Therefore these tasks will always meet their deadlines under the scheduling scheme:
P(A) = 1, P(B)=2, P(C)=3
Schedulability (part 1) - 11
RMA Example 1
t
C
B
A 20
30
50
20
10
30
idle idle
0 40 80 1006020 120 140 160 180 200
- task released
- task complete
Task Ci Ti Ui A 20 1000.2 B 30 1500.2 C 60 2000.3
Schedulability (part 1) - 12
Task Ci Ti Ui
A 12 50 0.24 B 10 40 0.25
C 10 30 0.33
U1 + U2 + U3 = 0.82, and is not URM(3)
where URM(3) = 3*(21/3 - 1) = 0.779
Therefore these tasks fail the utilization test, and by examination of their Gantt chart, it can be seen that all deadlines will not be met
RMA Example 2
Schedulability (part 1) - 13
RMA Example 2
t
C
B
A
0 20 40 503010 60 70
10
- task released
- task complete
10
10
10
x x - missed deadline
...10
Task Ci TiUi
A 12 500.24
B 10 400.25
C 10 300.33
Schedulability (part 1) - 14
RMA Example 3
Task Ci Ti Ui
A 40 80 0.5 B 10 40 0.25
C 5 20 0.25
U1 + U2 + U3 = 1.00, and is not URM(3)
again where URM(3) = 3*(21/3 - 1) = 0.779
These tasks clearly fail the utilization test, but after examination of their Gantt chart, it can be seen that all deadlines will be met ????
Schedulability (part 1) - 15
RMA Example 3
t
C
B
A
0 20 40 503010 60 70
5
- task released
- task complete
5
15
80
5 5 5
5
10 10
15
Task Ci Ti Ui A 40 80 0.5 B 10 40 0.25 C 5 20 0.25
Schedulability (part 1) - 16
Additional Points on RMA
RMA has the advantage of being stable in conditions of transient overload a subset of the tasks (those with the highest
priorities) will still meet their deadlines even in a temporary overload condition.
Completion Time Theorem for a set of independent periodic tasks, if each
task meets its first deadline when all tasks are started at the same time, then the deadlines will be met every time.
Schedulability (part 1) - 17
Weaknesses of RMA and U Test
utilization test is not exact sufficient, but not necessary therefore other tests must be used (besides manually
checking the timelines)
the simple task model is too restrictive only allows for periodic tasks all tasks must be independent
implies no shared resources (no mutexes)
introduce Response Time Analysis - a stronger schedulability test supports aperiodic (sporadic) tasks as well as dependence
Schedulability (part 1) - 18
References
[1] Burns, A. and Wellings, A., “Real-Time Systems and Programming Languages”, Chapter 13, Addison Wesley, 1997
[2] TimeSys Corp, “The Concise Handbook of Real-Time Systems”, Version 1.0, 1999
[3] www.timesys.com[4] Gomaa, H., “Software Design Methods for
Concurrent and Real-Time Systems”, Addison-Wesley, 1993.