Module-1: 1.1 Examples of Real Time Applications
Module-1: 1.1 Examples of Real Time Applications
Real Time Systems: A System is called Real Time System, when we need quantitative
notion of time to describe behaviour of system.
➢ System correctness depends not only on functioning but also on timing constraint,
applied on system.
Example: Air bag deployment must be within 1-2 milliseconds after accident, else the system
is considered as failure.
Examples of real-time systems include digital control, command and control, signal
processing etc.
1.Digital Control:
• Many real-time systems are embedded in sensors and actuators and function as digital
controllers. Following Figure shows such a system.
• The term plant in the block diagram refers to a controlled system, for example, a fire
alarm system, an aircraft, a patient.
• The state of the plant is monitored by sensors and can be changed by actuators. The
real-time (computing) system estimates from the sensor readings the current state of
the plant and computes a control output based on the difference between the current
state and the desired state (called reference input in the figure).
• We call this computation the control-law computation of the controller. The output
thus generated activates the actuators, which performs necessary action based on the
computation.
• The analog version is then transformed into a digital (i.e., discrete-time and discrete-
state) version.
• The resultant controller is a sampled data system. It typically samples (i.e., reads) and
digitizes the analog sensor readings periodically and carries out its control-law
computation every period.
Sneha Sureddy
Real Time Systems Notes Module-1
• The sequence of digital outputs thus produced is then converted back to an analog
form needed to activate the actuators.
a. Pseudo code :
set timer to interrupt periodically with period T ;
at each timer interrupt, do
do analog-to-digital conversion to get y;
compute control output u;
output u and do digital-to-analog conversion;
end do;
Here, we assume that the system provides a timer. Once set by the program, the timer
generates an interrupt every T units of time until its setting is cancelled.
b. Selection of Sampling Period. The length T of time between any two consecutive
instants at which y(t) and r (t) are sampled is called the sampling period.
• T is a key design choice. A small sampling period means more frequent control-law
computation and higher processor-time demand. We want a sampling period T that
achieves a good compromise. In making this selection, we need to consider
responsiveness of the overall system.
c. Multirate Systems. A plant is defined by multiple state variables (e.g.,fire alarm system
is having different types of sensors like heat,optical,smoke sensors ). Therefore, it is
monitored by multiple sensors and controlled by multiple actuators. We can think of a
multivariate (i.e., multi-input/multi-output)controller for such a plant as a system of
single-output controllers.
As different state variables have different sampling periods required to achieve smooth
responses. Digital controllers usually use multiple rates and are therefore called multirate
systems.
d. Timing Characteristics:
Each control-law computation can begin shortly after the beginning of each sampling period
when the most recent sensor data become available. (Typically, the time taken by an analog-
to-digital converter to produce sampled data and place the data in memory does not vary from
period to period and is very small compared with the sampling period.)
The computation should be completed before the next period processed sensor data is
available. This objective is met when the response time of each control-law computation
Sneha Sureddy
Real Time Systems Notes Module-1
never exceeds the sampling period. It should be maintained such that the variation in
response time does not exceed some threshold.
2. HIGH-LEVEL CONTROLS
Controllers in a complex monitor and control system are typically organized hierarchically.
One or more digital controllers at the lowest level directly control the physical plant. Each
output of a higher-level controller is a reference input of one or more lower-level
controllers.The higher-level controllers interfaces with the operator(s).
Figure 1–4 shows a more complex example: the hierarchy of flight control, flight
management and air traffic control systems.The Air Traffic Control (ATC) system is at the
Sneha Sureddy
Real Time Systems Notes Module-1
highest level. It regulates the flow of flights to each destination airport. It does so by
assigning to each aircraft an arrival time to the destination. The aircraft is supposed to arrive
at the metering fix at the assigned arrival time.
• The ATC system monitors the aircraft in its coverage area and the environment(e.g,
weather condition) and generates and presents the information needed by the
operators(i.e., the air traffic controllers). Outputs from the ATC system include the
assigned arrival times to metering fixes for individual aircraft.
• The assigned arrival time is a reference input to the flight management system. The flight
management system chooses a time-referenced flight path that brings the aircraft to the
metering fix at the assigned arrival time with the help of navigation.
• The cruise speed, turn radius, decent/accent rates, and so forth required to follow the
chosen time-referenced flight path are decided at the flight controller at the lowest level
of the control hierarchy.
As stated earlier, the outputs of ATC system are reference inputs to on-board flight
management systems. Thus, the ATC system indirectly controls the embedded components in
low levels of the control hierarchy. In addition, the ATC system provides voice and telemetry
links to on-board avionics. Thus it supports the communication among the operators at both
levels (i.e., the pilots and air traffic controllers).
3. Signal processing:
Most signal processing applications have some kind of real-time requirements. Examples are
digital filtering, video and voice compressing/decompression, and radar signal processing.
Radar Signal Processing : Radar signal processing and tracking system consists of an
Input/Output (I/O) subsystem that samples and digitizes the echo signal from the radar and
places the sampled values in a shared memory. An array of digital signal processors
processes these sampled values.
• To search for objects of interest in its coverage area, the radar scans the area by pointing
its antenna in one direction at a time. During the time the antenna dwells in a direction, it
first sends a short radio frequency pulse. It then collects and examines the echo signal
returning to the antenna.
• The echo signal consists solely of background noise if the transmitted pulse does not hit
any object. On the other hand, if there is a reflective object (e.g., an airplane) at a distance
x meters from the antenna, the echo signal reflected by the object returns to the antenna at
approximately 2x/c seconds after the transmitted pulse, where per
second is the speed of light.
• The echo signal collected at this time should be stronger than when there is no reflected
signal. If the object is moving, the frequency of the reflected signal is no longer equal to
that of the transmitted pulse.
Sneha Sureddy
Real Time Systems Notes Module-1
Therefore, by examining the strength and frequency spectrum of the echo signal, the system
can determine whether there are objects in the direction pointed at by the antenna and if there
are objects, what their positions and velocities are.
The term real-time database systems refers to a diverse spectrum of information systems,
ranging from stock price quotation systems, to track records databases, to real-time file
systems.
• Specifically, a real-time database contains data objects,that represent real-world objects.
The attributes of an object are those of the represented real world object. For example, an
air traffic control database contains objects that represent aircraft in the coverage area.
The attributes of such an object include the position and heading of the aircraft.
• The values of these attributes are updated periodically based on the measured values of
the actual position and heading provided by the radar system. Without this update, the
stored position and heading will deviate more and more from the actual position and
heading.
• Updates of the data should be done to maintain consistency and data integrity in the
real time databases.
• Concurrency control mechanisms, such as two-phase locking, have traditionally been
used to ensure the serializability of read and update transactions and maintain data
integrity of nonreal-time databases. These mechanisms often make it more difficult for
updates to complete in time. Late updates may cause the data to become temporally
inconsistent. Yet temporal consistency of real-time data is often as important as, or even
more important than, data integrity.
• Concurrency control mechanisms required to maintain a sense of consistency tend to
improve the timeliness of updates and reads.
Sneha Sureddy
Real Time Systems Notes Module-1
• Another dimension of quality of a multimedia application is lip synchronization. This
term refers to the temporal synchronization of the video frames and related audio data
units. In the case where the video is that of a speaker, the speaker’s lips should appear to
move to make the accompanied speech.
Sneha Sureddy
Real Time Systems Notes Module-1
train may cause a collision, and a bomb dropped too late may hit a civilian population
instead of the intended military target).
2. In contrast, the late completion of a job that has a soft deadline is undesirable.
However, a few misses of soft deadlines do no serious harm; only the system’s overall
performance becomes poorer and poorer when more and more jobs with soft deadlines
complete late.
3. In real-time systems literature, the distinction between hard and soft timing constraints is
stated quantitatively in terms of the usefulness of results as functions of the tardinesses
of jobs.
• The tardiness of a job measures how late it completes respective to its deadline. Its
tardiness is zero if the job completes at or before its deadline; otherwise, if the job is late,
its tardiness is equal to the difference between its completion time (i.e., the time instant
at which it completes execution) and its deadline.
The usefulness of a result produced by a soft real-time job (i.e, a job with a soft deadline)
decreases gradually as the tardiness of the job increases, but the usefulness of a result
produced by a hard real-time job (i.e., a job with a hard deadline) falls off abruptly and
may even become negative when the tardiness of the job becomes larger than zero.
4. For hard real-time applications (e.g., digital controllers), all the tasks and jobs executed in
every operation mode of the system are known a priori. Safety and reliability is increased
for hard real time systems,such that they should not miss the deadline.
5. For hard real time system, temporal quality of service is guaranteed i.e, it guarantees
that task will be executed with in its deadline and where as by the soft real time systems,
best-effort services are given i.e., it tries at most to complete its job with atleast a certain
probability by its deadline. The deadline of a job is softer if the usefulness of its result
decreases at a slower rate.
6. For Soft real time systems, meeting all deadlines is not the only consideration, An
occasional missed deadline or aborted execution is usually considered tolerable; it may be
more important for such a system to have a small average response time and high
throughput.
• Multimedia systems are soft real time systems that provide the user with services of
good quality. For example, a frame of a movie must be delivered every thirtieth of a
second, and the difference in the times when each video frame is displayed and when the
accompanied speech is presented should be no more than 80 msec. However, the users
are often willing to tolerate a few glitches, as long as the glitches occur rarely and for
short lengths of time.
➢ Processors are called active resources; computers, transmission links, disks, and
database server are examples of Processors. They carry out machine instructions,
move data from one place to another, retrieve files, process queries, and so on. Every
job must have one or more processors in order to execute and make progress toward
completion.
➢ Resources are passive resources. Examples of resources are memory, sequence
numbers, mutexes, and database locks. A job may need some resources in addition to
the processor in order to make progress.
One of the attributes of a processor is its speed. The rate of progress a job makes toward its
completion depends on the speed of the processor on which it executes.In contrast, we do not
associate speed with a resource. In other words, how long a job takes to complete does not
depend on the speed of any resource it uses during execution.
• As an example,a data link that uses the sliding-window scheme to regulate message
transmission. Only a maximum number of messages are allowed to be in transit (i.e., they
have been transmitted but their reception has not yet been positively acknowledged). One
way to implement this scheme is for the sender to maintain a window of valid sequence
numbers.. A message waiting to be transmitted must first be given one of the valid
sequence numbers before it can be transmitted. We model the transmission of a message
as a job; the job executes when the message is being transmitted. This job needs the data
link, as well as a valid sequence number. The data link is a processor. The sequence
numbers are units of the sequence-number resource.
• A set of related jobs that execute to support a function of the system is a task.
• Each job Ji is characterized by its temporal parameters, functional parameters,
resource parameters, and interconnection parameters. Its temporal parameters tell us
its timing constraints and behaviour. Its interconnection parameters describe how it
depends on other jobs and how other jobs depend on it. Its functional parameters specify
the intrinsic properties of the job. Finally, its resource parameters give us its resource
requirements.
• Release time, absolute deadline, and relative deadline of a job are temporal
parameters.
Sneha Sureddy
Real Time Systems Notes Module-1
• The time interval between the release time and absolute deadline of the job is called its
feasible interval.
Sneha Sureddy
Real Time Systems Notes Module-1
• Generally, the period and execution time of every periodic task in the system are known.
The accuracy of the periodic task model decreases with increasing jitter in release times
and variations in execution times.
a) PHASE of a task: The release time of the first job in each task is called the phase of a
Task. φi is used to denote the phase of Task , that is, φi = ri,1. In general, different tasks
may have different phases. Some tasks are in phase, meaning that they have the same
phase.
b) HYPERPERIOD:
Hyperperiod is the smallest interval of time after which the periodic patterns of all the tasks is
repeated.
It is the least common multiple of pi for i = 1, 2, . . . n. A time interval of length H is called a
hyperperiod of the periodic tasks.
The length of a hyperperiod of three periodic tasks with periods 3, 4, and 10 is 60.
c) Utilization of processor: Utilization by the task is the ratio of execution time and period
i.e., ui = ei /pi keeps a processor busy.
The total utilization U of all the tasks in the system is the sum of the utilizations of the
individual tasks in it. So, if the execution times of the three periodic tasks are 1, 1, and 3, and
their periods are 3, 4, and 10, respectively, then their utilizations are 0.33, 0.25 and 0.3. The
total utilization of the tasks is 0.88; these tasks can keep a processor busy at most 88 percent
of the time. Utilization of the processor will be less if more number of dependent jobs are
present in the task.
However, Response time and throughput are not considered in hard real time applications
only primary consideration is to complete the execution of all the jobs in the task by the time
of its deadline.
The numbers in the bracket above each job give its feasible interval. The edges in the graph
represent dependencies among jobs. If all the edges are precedence edges, representing
precedence constraints, then the graph is a precedence graph.
• Specifically, the system described by the graph in above Figure includes two periodic
tasks.
➢ The task whose jobs are represented by the vertices in the top row has phase 0, period 2,
and relative deadline 7. The jobs in it are independent; there are no edges to or from
these jobs. In other words, the jobs released in later periods are ready for execution as
soon as they are released even though some job released earlier is not yet complete.
Sneha Sureddy
Real Time Systems Notes Module-1
• The vertices in the second row of represent jobs in a periodic task with phase 2, period 3,
and relative deadline 3. The jobs in it are dependent;
➢ The first job is the immediate predecessor of the second job, the second job is the
immediate predecessor of the third job, and so on. The precedence graph of this task is a
chain as shown here. Hence the jobs must be executed in serial order.
A task graph,is an extended precedence graph following Figure shows a task graph. As in a
precedence graph, the vertices in a task graph represent jobs. They are shown as circles and
squares in this figure.
• Many types of interactions and communication among jobs are not captured by a
precedence graph but can be captured by a task graph. Unlike a precedence graph, a task
graph may contain different types of edges that represent different types of dependencies.
➢ Data Dependency
Data dependency cannot be captured by a precedence graph but by task graph. In many real
time systems, jobs communicate via shared data.
▪ Oftentimes, the designer chooses not to synchronize producer and consumer jobs. Rather,
each producer places the data generated by it in a shared address space to be used by the
consumer at any time. In this case, the classical precedence graph should show that the
producer and consumer are independent because they are not explicitly constrained to
execute in turn.
▪ As an example, in an avionics system, the navigation job updates the location of the
airplane periodically. These data are placed in a shared space. Whenever the flight
management job needs navigation data, it reads the most current data produced by the
navigation job. There is no precedence constraint between the navigation job and the
flight management job.
▪ In a task graph, data dependencies among jobs are represented explicitly by
datadependency edges among jobs. There is a data-dependency edge from a vertex Ji to
vertex Jk in the task graph if the job Jk consumes data generated by Ji.
▪ To ensure data integrity, some locking mechanism may be in place, and this mechanism
allows only one job to access the shared data at a time. This leads to resource contention,
which may also constrain the manner in which jobs execute.
➢ Criticality of Jobs
In any system, jobs are not equally important. The importance (or criticality) of a job is a
positive number that indicates how critical the job is with respect to other jobs; the more
critical the job, the larger its importance.
▪ In literature, the terms priority and weight are often used to refer to importance; the more
important a job, the higher its priority or the larger its weight.
▪ During an overload when it is not possible to schedule all the jobs to meet their deadlines,
it may make sense to sacrifice the less critical jobs so that the more critical jobs can meet
their deadlines.
▪ The information concerning the criticality of jobs must be given to the scheduler by
scheduling and resource access-control algorithms.
▪ Assigning importance to each job is a natural way to do so.For example, in a flight
control and management system, the navigation job is more critical than the job that runs
the in-flight movies, and so on.
➢ Optional Executions
It is often possible to structure an application so that some jobs are optional.
▪ If an optional job completes late or is not executed at all, the system performance may
degrade, but function satisfactorily. In contrast, jobs that are not optional are mandatory;
they must be executed to completion.
▪ Therefore, during a transient overload when it is not possible to complete all the jobs in
time, we may choose to discard optional jobs (i.e, leave them unexecuted or partially
executed) so that the mandatory jobs can complete in time. In this way, the system can
Sneha Sureddy
Real Time Systems Notes Module-1
trade the quality of the results it produces and the services it delivers for timeliness of its
results and services.
▪ In our model, the optional parameter of each job indicates the portion of the job that is
optional. Marking a job or a portion of a job optional is another way for the designer to
indicate that the job is not critical.
By explicitly identifying the optional jobs and using a scheduling strategy that takes
advantage of this information, the designer can control the manner in which the system
degrades.
Sneha Sureddy
Real Time Systems Notes Module-1
➢ Preemptivity of Resources: If a resource is nonpreemptable, it is allocated to a job,
other jobs needing the resource unit must wait until the job completes its use.
▪ Otherwise, if jobs can use every unit of a resource in an interleaved fashion, the
resource is preemptable.
▪ The lock on a data object in a database is an example of nonpreemptable resource.
When a job modeling a transaction that reads and writes the data object has acquired
the lock, other jobs that also require this lock at the time must wait.
▪ We can preempt the transmission of a less urgent message in preference to more
urgent messages without having to retransmit the less urgent message in entirety. In
other words, message transmission jobs are in fact preemptable.
➢ Resource Graph
We can describe the configuration of the resources using a resource graph. In a resource
graph, there is a vertex Ri for every processor or resource in the system.
▪ The attributes of the vertex are the parameters of the resource. In particular, the resource
type of a resource tells us whether the resource is a processor or a (passive) resource, and
its number gives us the number of available units.
▪ While edges in task graphs represent different types of dependencies among jobs, edges
in a resource graph represent the relationship among resources. Using different types of
edges, we can describe different configurations of the underlying system.
▪ The resource graph describes the amounts of the resources available to execute the
application system, the attributes of the resources, and the rules governing their usage.
Jobs are scheduled and allocated resources according to a chosen set of scheduling algorithms
and resource access-control protocols. The module which implements these algorithms is
called the scheduler.
The scheduler produces only valid schedules & assigns processors to jobs,; a valid schedule
satisfies the conditions like Every processor is assigned to at most one job at any time, Every
job is assigned at most one processor at any time.No job is scheduled before its release time
etc..
Sneha Sureddy
Real Time Systems Notes Module-1