As Old Grow
As Old Grow
Chapter 1: Introduction
1. Real-Time Systems and Embedded Systems:
The term “real-time system” refers to any information processing system with hardware
and software components that perform real-time application functions and can respond
to events within predictable and specific time constraints.
In many cases, the real-time computer running the application is embedded into the system
to be controlled. Embedded systems span from small portable devices (e.g., cellular phones,
cameras, navigators, ECG Holter devices, smart toys) to larger systems (e.g., industrial
robots, cars, aircrafts).
1
Real Time and Embedded Systems (CoSc3026)
produce correct result within the given time interval. If the result is not obtained
within the given time interval then also result is not considered correct. In real-
time systems, correctness of result is to obtain correct result in time constraint.
3. Embedded:
All the real-time systems are embedded now-a-days. Embedded system means
that combination of hardware and software designed for a specific purpose. Real-
time systems collect the data from the environment and passes to other
components of the system for processing.
4. Safety:
Safety is necessary for any system but real-time systems provide critical safety.
Real-time systems also can perform for a long time without failures. It also
recovers very soon when failure occurs int he system and it does not cause any
harm to the data and information.
5. Concurrency:
Real-time systems are concurrent that means it can respond to a several number
of processes at a time. There are several different tasks going on within the system
and it responds accordingly to every task in short intervals. This makes the real-
time systems concurrent systems.
6. Distributed:
In various real-time systems, all the components of the systems are connected in
a distributed way. The real-time systems are connected in such a way that different
components are at different geographical locations. Thus all the operations of real-
time systems are operated in distributed ways.
7. Stability:
Even when the load is very heavy, real-time systems respond in the time constraint
i.e. real-time systems does not delay the result of tasks even when there are several
task going on a same time. This brings the stability in real-time systems.
2. Reference model of the real-time system:
The RTS model is characterized by three elements:
1. A workload model: It specifies the application supported by the system.
2. A resource model: It specifies the resources available to the application.
3. Algorithms: It specifies how the application system will use resources.
2
Real Time and Embedded Systems (CoSc3026)
3
Real Time and Embedded Systems (CoSc3026)
4
Real Time and Embedded Systems (CoSc3026)
• A schedule means an assignment of all the jobs in the system on the available
processors produced by the scheduler
• We assume that the scheduler produces only valid schedules:
① 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
④ Depending on the scheduling algorithm(s) used, the total amount of processor
time assigned to every job is equal to its maximum or actual execution time
⑤ All the precedence and resource usage constraints are satisfied
• An implicit assumption is that jobs do not run in parallel on more than one processor
to speed up their execution
• Scheduling Algorithms: Clock-Driven Approach, Weighted Round-Robin Approach,
Priority-Driven Approach,
3. Types of Real time Tasks
The system is subjected to real-time, i.e. response should be guaranteed within a specified
timing constraint or system should meet the specified deadline. For example, flight control
systems, real-time monitors, etc.
Terms related to real-time system:
1. Job: A job is a small piece of work that can be assigned to a processor and may
or may not require resources.
2. Task: A set of related jobs that jointly provide some system functionality.
3. Release time of a job: It is the time at which the job becomes ready for
execution.
4. Execution time of a job: It is the time taken by the job to finish its execution.
5. Deadline of a job: It is the time by which a job should finish its execution.
Deadline is of two types: absolute deadline and relative deadline.
6. Response time of a job: It is the length of time from the release time of a job to
the instant when it finishes.
7. The maximum allowable response time of a job is called its relative deadline.
8. The absolute deadline of a job is equal to its relative deadline plus its release time.
9. Processors are also known as active resources. They are essential for the execution
of a job. A job must have one or more processors in order to execute and proceed
towards completion. Example: computer, transmission links.
5
Real Time and Embedded Systems (CoSc3026)
10. Resources are also known as passive resources. A job may or may not require a
resource during its execution. Example: memory, mutex
11. Two resources are identical if they can be used interchangeably else they are
heterogeneous.
There are following types of tasks in real-time systems:
1. Periodic tasks
2. Dynamic tasks
3. Critical tasks
4. Non-critical tasks
1. Periodic Tasks: In periodic tasks, jobs are released at regular intervals. A periodic
task is one that repeats itself after a fixed time interval. A periodic task is denoted by
four tuples: Ti = < Φi, Pi, ei, Di >
Where,
• Φi – is the phase of the task. Phase is the release time of the first job in
the task. If the phase is not mentioned then the release time of the first
job is assumed to be zero.
• Pi – is the period of the task i.e. the time interval between the release
times of two consecutive jobs.
• ei – is the execution time of the task.
• Di – is the relative deadline of the task.
For example: Consider the task Ti with period = 5 and execution time = 3
Phase is not given so, assume the release time of the first job as zero. So the job of this task is
first released at t = 0 then it executes for 3s and then the next job is released at t = 5 which
executes for 3s and then the next job is released at t = 10. So, jobs are released at t = 5k where
k = 0, 1, . . ., n
Hyper period of a set of periodic tasks is the least common multiple of periods of all the tasks
in that set. For example, two tasks T1 and T2 having period 4 and 5 respectively will have a
6
Real Time and Embedded Systems (CoSc3026)
hyper period, H = lcm(p1, p2) = lcm(4, 5) = 20. The hyper period is the time after which pattern
of job release times starts to repeat.
2. Dynamic Tasks: It is a sequential program that is invoked by the occurrence of an event.
An event may be generated by the processes external to the system or by processes internal
to the system. Dynamically arriving tasks can be categorized on their criticality and
knowledge about their occurrence times.
• Aperiodic Tasks: In this type of task, jobs are released at arbitrary time intervals i.e.
randomly. Aperiodic tasks have soft deadlines or no deadlines.
• Sporadic Tasks: They are similar to aperiodic tasks i.e. they repeat at random
instances. The only difference is that sporadic tasks have hard deadlines. A sporadic
task is denoted by three tuples: Ti =(ei, gi, Di)
Where
ei – the execution time of the task.
gi – the minimum separation between the occurrence of two consecutive instances of
the task.
Di – the relative deadline of the task.
3. Critical Tasks: Critical tasks are those whose timely executions are critical. If
deadlines are missed, catastrophes occur. For example, life-support systems and the
stability control of aircraft. If critical tasks are executed at a higher frequency, then it is
necessary.
4. Non-critical Tasks: Non-critical tasks are real times tasks. As the name implies, they
are not critical to the application. However, they can deal with time, varying data, and
hence they are useless if not completed within a deadline. The goal of scheduling these
tasks is to maximize the percentage of jobs successfully executed within their deadlines.
4. Modelling Timing Constraints
Timing constraints is a vital attribute in real-time systems. Timing constraints decides the
total correctness of the result in real-time systems. The correctness of results in real-time
system does not depends only on logical correctness but also the result should be obtained
within the time constraint. There might be several events happening in real time system and
these events are scheduled by schedulers using timing constraints.
Types of real-time systems based on timing constraints:
1. Hard real-time system: This type of system can never miss its deadline.
Missing the deadline may have disastrous consequences. The usefulness of
results produced by a hard real-time system decreases abruptly and may
7
Real Time and Embedded Systems (CoSc3026)
D >= d
8
Real Time and Embedded Systems (CoSc3026)
D <= d
9
Real Time and Embedded Systems (CoSc3026)
10
Real Time and Embedded Systems (CoSc3026)
11
Real Time and Embedded Systems (CoSc3026)
the IBR, or it can be obtained from memory by loading a word into the MBR, and then down
to the IBR, IR, and MAR. Finally, execution cycle executes the instruction,
6. Real Time Systems and Design
The design of real-time computing systems is the most challenging and complex task that can
be undertaken by a software engineer. By its very nature, software for real-time systems makes
demands on analysis, design and testing techniques that are unknown in other application
areas. A real time system must also integrate the hardware, the software, the user and the
database to achieve certain results with an acceptable performance. Real-time software is
highly coupled to the external world. That is, real-time software must respond to the problem
domain (the real world) in a time frame dictated by the problem domain. Because real-time
software must operate under rigorous performance constraints, software design is often driven
by hardware as well as software architecture, operating system characteristics as well as
application requirements, programming language vagaries as well as design issues.
▪ Data acquisition
▪ Measurement, interpretation and evaluation
▪ Decision making and action
▪ Initialization, operation and control.
The real time, systems are developed for diverse applications in the process control, process
automation, medical and scientific research traffic management, aerospace systems and
instrumentation. In all these applications, the real time system responds to the external
stimulate in a time which is governed by the external world.
Real-time systems generate some action in response to external events. To accomplish this
function, they perform high-speed data acquisition and control under severe time and reliability
constraints. Because these constraints are so stringent, real-time systems are frequently
dedicated to a single application.
Like any computer-based system, a real-time system must integrate hardware, software,
human, and data base elements to properly achieve a set of functional and performance
requirements.
The entire cycle of acquisition, measurement, evaluation, decision making, action, control and
bringing the system back to the initial condition is highly time sensitive. If this cycle is not
performed in a time within which no damage is possible then the system performance is
acceptable. Failing this, the real time system needs re-look and redesign in most of the
12
Real Time and Embedded Systems (CoSc3026)
applications, the real time systems are many and they are organized to obtain certain output.
They are dependent on each other and some of them run in parallel and some in sequence.
Some of these work on priority which is in-built in the total application design.
In the real time, systems are analysed in an industrial application or in the business commercial
application, it will be found that their functional requirements are same. They are as follows:
The real time systems are designed first with a prototype and then rigorously tested through
simulation processes to confirm the accuracy in handling the following features:
The real time software system has all the aspects of the conventional system design and in
addition it has to handle a new set of requirements arising out of the real time feature. The real
time software is either time or event driven and hence the hardware and software which deals
with these parameters gather a lot of importance in design of the system.
There are three characteristics that differentiate real-time software development from other
software engineering efforts:
• The design of real-time system is resource constrained. The primary resource for a
real-time system is time. It is essential to complete a defined task within a given number
of CPU cycles. In addition, other system resources, such as memory size, may be traded
against time to achieve system objectives.
13
Real Time and Embedded Systems (CoSc3026)
software represents a very small percentage of the total. It is this small percentage of
code that is typically the most complex (from an algorithmic point of view).
• Real-time systems often work without the presence of a human user. Therefore, real-
time software must detect problems that lead to failure and automatically recover from
these problems before damage to data and the controlled environment occurs.
There are various design metric required to design any system to function properly, they are
14