Unit 1 RTOS
Unit 1 RTOS
Input and output channels between processor cores and devices are one of the most important
resources in real time embedded systems. The coverage of I/O resource management includes
•Latency: arbitration latency for shared I/O interfaces, read latency, time to transit from
device to CPU core, write latency
•Bandwidth(BW): avg. bytes transferred per unit time
•Queue depth: write buffer stall, read buffers
•CPU coupling: DMA channels help decouple the CPU from I/O
Memory resources are designed based upon cost, capacity and access latency
•Memory hierarchy from least to most latency
- Level 1 cache: single cycle access, Harvard Architecture (separate data and instruction
caches), locked for use as fast memory
- Level 2 cache: few or no wait states, typically unified, backs L1 cache
RESOURCE ANALYSIS
The conclusion that can be drawn is that for a two-service system, the RM policy is optimal
RM-Rate Monotonic function (assign highest priority to the service with the shortest release period)
PREEMPTION FIXED PRIORITY
POLICY
Liu and Layland proposed this simple feasibility test they call the RM Least Upper Bound (RM LUB).
U: Utility of the CPU resource achievable
C: Execution time of Service i
m: Total number of services in the system sharing common CPU resources
T : Release period of Service i
Given Services S1, S2 with periods T1 and T2 and C1 and C2, assume
Feasibility tests provide a binary result that indicates whether a set of services (threads or tasks) can be scheduled given
their Ci, Ti, and Di, specification.
So, the input is an array of service identifiers(Si) and specification for each and the output is TRUE if the set can
be safely scheduled so that none of the deadlines will be missed and FALSE if any one of the deadlines might be
missed. There are two types of feasibility tests:
1.Sufficient
2.Necessary and Sufficient(N&S)
Sufficient feasibility tests will always fail a service set that is not real time safe (i.e.,that can miss deadlines).
However, a sufficient test will also fail a service set that is real—time—safe occasionally as well.
Sufficient feasibility tests are not precise. The sufficient tests are conservative because they will never pass an
unsafe set of services.
N&S are precise. An N&S feasibility test will not pass a service set that is unsafe and likewise will not fail any test
that is safe.
The RM LUB is a sufficient test and therefore safe, but it will fail service sets that actually can be safely scheduled.
FEASIBILITY TEST
Two algorithms for determination of N&S feasibility testing with RM policy are easily employed:
1.Scheduling Point Test
2.Completion Time Test
•By the Lehoczky, Shah, Ding theorem, if a set of services can be shown to meet all deadlines form the critical
instant up to the longest deadline of all tasks in the set, then the set is feasible.
•The critical instant assumption from Liu and Layland, states that in the worst case, all services might be
requested at the same point in time.
•Lehoczky, Shah, and Ding introduced an iterative test for this theorem called the Scheduling Point Test
NECESSARY AND SUFFICIENT
(N&S) FEASIBIALITY
Passing this test requires proving that an(t) is less than or equal to the deadline for Sn , which proves
that Sn , is feasible.
DEADLINE MONOTONIC POLICY
Deadline—monotonic(DM) policy is very similar to RM except that highest priority is assigned to the
service with the shortest deadline. The DM policy is a fixedpriority policy.
The DM policy eliminates the original RM assumption that service period must equal service deadline and allows
RM theory to be applied for scenarios even when deadline is/less than period. This is useful for dealing with
significant output latency.
Ci is the execution time for service i,and Ii is the interference time service iexperiences over its deadline Di, time
period since the time of request for service.
For all services from 1 to 11, if the deadline interval is long enough to contain the service execution time interval
plus all interfering execution time intervals, then the service is feasible. If all services are feasible, then the system
is feasible (real—time safe).
Interference to Service Si, is due to preemption by all higher priority services Si to Si-1,
C is the worst case number of releases of Sj over the deadline interval for Si,
Because the interference is the worst—case number of releases, interference is over- accounted for the last
interference may be only partial.
DYNAMIC PRIORITY POLICIES
The policy Liu and Layland specified in their paper later became known as an EDF (Earliest Deadline First)
dynamic priority policy. The policy is called EDF because the scheduler gives highest priority to the service that
has the soonest deadline
The EDF scheduler must be able to insert the new thread into the queue based upon time to its deadline relative to
the time to deadline for all other threads——the insertion has a complexity that is of the order n — O(n),
where n is the number of threads on the queue. By comparison a fixed priority policy scheduler can be
implemented with complexity that is 0(1), or constant time using priority queues.
LLF is a dynamic-priority policy where services on the ready queue are assigned higher priority if their
laxity is the least. Laxity is the time difference between their deadline and remaining computation time.
By comparison, for fixed priority policy such as RM, in an overload,
all services of lower priority than the service that is overrunning
may miss their deadline, yet all services of higher priority are
guaranteed not to be affected as shown in Figure
DYNAMIC PRIORITY POLICIES
Self Study :
Worst case execution
Deadlock and Livelock
THANK YOU