Professional Documents
Culture Documents
Real Time System - : BITS Pilani
Real Time System - : BITS Pilani
Lecture 2
BITS Pilani Rekha.A
Pilani Campus
Timing Constraint
BITS Pilani
Pilani Campus
Timing Constraints
A timing constraint
- Defined with respect to some event
An Event
- Can occur at instant of time
- May also have duration
- Generated either by system or environment
Minimum:
Once a duration event starts, it must not end before a certain
minimum time
Maximum:
Once a duration event starts, it must end before a certain
maximum time
12
BITS Pilani, Pilani Campus
Three Elements of a Model
Processors
Active resources e.g. Computers, Transmission links, Servers etc
Denoted by P
Resources
Passive resources e.g. Sequence numbers, Database locks etc
A job may need some resources in addition to the processor in order to make
progress
Denoted by R
14
BITS Pilani, Pilani Campus
Assumptions
Many parameters of hard real-time jobs are known at all time
For example, number of tasks in a hard-real time system is known at the
beginning
Rate of progress of a job depends upon the speed of the processor on
which it executes
Rate of progress of a job doesn’t depend upon the resources it use during
execution
Plentiful resources (resources for which no job is prevented from execution)
are omitted from the consideration
Memory is considered as a plentiful resource, hence omitted from the
consideration
15
BITS Pilani, Pilani Campus
Parameters associated with a
Job
Job: Work done by a system e.g. computation of a control law, FFT
computation etc
16
BITS Pilani, Pilani Campus
Temporal Parameters
It includes :
• release time(ri)
• absolute deadline(di)
• relative deadline(Di)
• Execution time(Ei).
• Feasible interval
Release Time, Relative Deadline and Absolute Deadline are the Temporal Parameters of Job Ji
18
BITS Pilani, Pilani Campus
Example
A system which monitors and controls several furnaces
At the beginning, the system is initialized and starts execution (time 0 ms).
The system samples and reads each temperature sensor every 100 ms.
The system computes the control law of each furnace every 100 ms.
Period pk = 100 ms
If each job needs to be completed within 70 ms, then the absolute deadlines of the jobs: 90 ms, 190 ms, 290 ms, …
Relative deadline Dk = 70 ms 19
BITS Pilani, Pilani Campus
Fixed, Jittered and sporadic
release times
The release time may not be exactly known, only the range
may be known[ri- ri+].
When only the range of ri is known then this range is
called release time jitter.
If the jitter is negligible or Zero ,This release time of the
job is called fixed release time.
Every real time system is required to respond to
unexpected external events which occur at random
instant which are called sporadic jobs.
Tasks in the system are denoted as: T1, T2, T3, …., Tn
21
BITS Pilani, Pilani Campus
Period pi of a periodic task Ti is the time interval between the release
times of two consecutive jobs.
Jobs in Task Ti are denoted as: Ji,1, Ji,2, Ji,3, …., Ji,k
The release times of the jobs in Task Ti are denoted as: ri,1, ri,2, ri,3,
…., ri,k
Ti Ti+1
23
BITS Pilani, Pilani Campus
Periodic Task Model
The release time of the first job Ji,1 in each task Ti is called Phase Φi of the Task Ti i.e.
Φi =ri,1
Two tasks are said to be in phase, when they have same phase.
Hyperperiod H of a set of periodic task is the least common multiple of periods of all the
tasks in that set.
H = LCM(p1, p2, …, pk)
Relative deadline (or simply deadline) Di of a task Ti is the maximum allowable time for each
job of the task to complete i.e. maximum response time for each job of the task.
This is the time after which the pattern of job release repeat
tasks ule d
e d
ch
T1 Uns view
T2
T3
0 1 2 3 4 5 6 7 8 9 time
Tasks Φi pi ei Di ui
T1 1 3 1 3 0.33
T2 2 4 1 4 0.25
T3 1 5 2 5 0.4
26
BITS Pilani, Pilani Campus
Periodic Task Model
Utilization of task Ti is the ratio of execution time and period
Utilization of task Ti
ei
ui
pi
Total Utilization
n
ei
U
i 1 pi 27
BITS Pilani, Pilani Campus
If execution time of three periodic tasks are 1,1 and 3 with
periods 3,4 and 10 respectively . What is the total
utilization
Solution:
29
BITS Pilani, Pilani Campus
Aperiodic and Sporadic jobs
We call a task to be aperiodic if the jobs in it have either soft
deadlines or no deadline.
32
BITS Pilani, Pilani Campus
Precedence Graph - Example
J1 (0, 6] J2 (5, 8]
J3 (2, 8] J4 (3, 5]
J1, J2, J3 and J4 have feasible intervals (0, 6], (5, 8], (2, 8] and (3,
5] respectively
J1 and J4 are predecessors of J2
J3 is neither a predecessor, not a successor of any other jobs
33
BITS Pilani, Pilani Campus
Task Graph
Task Graph is extended Precedence Graph.
It uses different types of edges to represent different dependencies.
Each vertex represents a job, which is indicated by circles and
squares.
Above each vertex, the feasible interval for the job is mentioned in
brackets.
A sub-graph becomes a chain, when the jobs in the sub-graph need
to be serially executed i.e. either Ji < Jk or Ji > Jk .
Unlike precedence graph, the edges are of different types
representing different types of dependencies.
The types of an edge connecting two vertices and other parameters
of the edge are interconnection parameters of the jobs
represented by the vertices.
34
BITS Pilani, Pilani Campus
Task Graph
36
BITS Pilani, Pilani Campus
AND / OR Precedence
Constraints
A job with more than one immediate predecessor must wait
until all its immediate predecessors have been completed
before its execution can begin
An AND job is the one which can begin execution at or after its
release time provided all of its predecessors has been completed.
AND jobs are represented by unfilled circles in the task graph.
An OR job is the one which can begin execution at or after its
release time provided one or some of its immediate predecessors
has been completed.
OR jobs are represented by unfilled squares in the task graph.
The fraction of the number of predecessor to be completed is
indicated below the vertex e.g. if 2 out of 3 jobs are to be
completed, then put 2/3 there.
37
BITS Pilani, Pilani Campus
Task Graph - Example
branch join
1/2
(4, 8]
38
BITS Pilani, Pilani Campus
Conditional Branches
The job from which the conditional branch arises is called a
branch job.
The job at which the conditional branches join is called a join
job.
Both these jobs are represented as filled circles in the task
graph.
The sub-graph that begins from the branch job and ends at
the join job is called conditional block.
39
BITS Pilani, Pilani Campus
Conditional block
41
BITS Pilani, Pilani Campus
Task Graph - Example
branch join
1/2
(4, 8]
42
BITS Pilani, Pilani Campus
Example problem
Consider the real-time program described by the psuedo code below. Names of jobs are
in italic.