0% found this document useful (0 votes)
89 views14 pages

As Old Grow

This document provides an introduction to real-time and embedded systems. It discusses that real-time systems must respond to events within predictable time constraints. Embedded systems combine dedicated hardware and software to control systems. The document then describes key characteristics of real-time systems like time constraints, correctness, safety, concurrency and stability. It also discusses the reference model of real-time systems including workload, resource and scheduling algorithms. Finally, it outlines different types of real-time tasks such as periodic, dynamic, critical and non-critical tasks.

Uploaded by

Temesgen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views14 pages

As Old Grow

This document provides an introduction to real-time and embedded systems. It discusses that real-time systems must respond to events within predictable time constraints. Embedded systems combine dedicated hardware and software to control systems. The document then describes key characteristics of real-time systems like time constraints, correctness, safety, concurrency and stability. It also discusses the reference model of real-time systems including workload, resource and scheduling algorithms. Finally, it outlines different types of real-time tasks such as periodic, dynamic, critical and non-critical tasks.

Uploaded by

Temesgen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Real Time and Embedded Systems (CoSc3026)

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).

Figure: Generic Block Diagram of Generic Real Time Control System


Embedded Systems:
“The embedded systems which respond to real time situation with the help of its embedded
software and hardware, within the specified time constraints are called real time embedded
systems.”
Characteristics of Real-time System:
Followings are the some of the characteristics of Real-time System:
1. Time Constraints:
Time constraints related with real-time systems simply means that time interval
allotted for the response of the ongoing program. This deadline means that the
task should be completed within this time interval. Real-time system is
responsible for the completion of all tasks within their time intervals.
2. Correctness:
Correctness is one of the prominent part of real-time systems. Real-time systems

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)

• We divide all the system resources into processors and resources


• Processors are often called servers and active resources
– computers, transmission links, disks, and database server
– denoted by P , P ,  , P
1 2 m

– Every job must have one or more processors to execute


– Speed is the main attribute of a processor
• Resources mean passive resources
– memory, sequence numbers, mutexes, and database locks
– A job may need some resources in addition to the processor
(ex. semaphore)
– denoted by R1 , R2 ,  , Rn
– Each resource may have one or more units

3
Real Time and Embedded Systems (CoSc3026)

• The scheduler assigns processors to jobs

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)

become negative if tardiness increases. Tardiness means how late a real-time


system completes its task with respect to its deadline. Example: Flight
controller system.
2. Soft real-time system: This type of system can miss its deadline
occasionally with some acceptably low probability. Missing the deadline have
no disastrous consequences. The usefulness of results produced by a soft
real-time system decreases gradually with an increase in tardiness. Example:
Telephone switches.
Classification of Timing Constraints based on Modeling: Timing constraints associated
with the real-time system is classified to identify the different types of timing constraints in a
real-time system. Timing constraints are broadly classified into two categories:
1. Performance Constraints: The constraints enforced on the response of the system is known
as Performance Constraints. This basically describes the overall performance of the system.
This shows how quickly and accurately the system is responding. It ensures that the real-time
system performs satisfactorily.
2. Behavioral Constraint: The constraints enforced on the stimuli generated by the
environment is known as Behavioral Constraints. This basically describes the behavior of the
environment. It ensures that the environment of a system is well behaved.
Further, the both performance and behavioral constraints are classified into three categories:
Delay Constraint, Deadline Constraint, and Duration Constraint. These are explained as
following below.

1. Delay Constraint – A delay constraint describes the minimum time interval


between occurrence of two consecutive events in the real-time system. If an
event occurs before the delay constraint, then it is called a delay violation. The
time interval between occurrence of two events should be greater than or equal
to delay constraint.
If D is the actual time interval between occurrence of two events and d is the
delay constraint, then

D >= d

8
Real Time and Embedded Systems (CoSc3026)

Figure: Delay Constraint


2. Deadline Constraint: A deadline constraint describes the maximum time interval
between occurrence of two consecutive events in the real-time system. If an event
occurs after the deadline constraint, then the result of event is considered incorrect. The
time interval between occurrence of two events should be less than or equal to deadline
constraint.
If D is the actual time interval between occurrence of two events and d is the
deadline constraint, then

D <= d

Figure: Deadline Constraint


3. Duration Constraint: Duration constraint describes the duration of an event in
real-time system. It describes the minimum and maximum time period of an event.
On this basis it is further classified into two types:
0. Minimum Duration Constraint: It describes that after the initiation of
an event, it can not stop before a certain minimum duration.
1. Maximum Duration Constraint: It describes that after the starting of
an event, it must end before a certain maximum duration elapses.
5. Computer Organization concepts and Memory:
In 1946, von Neumann and his colleagues began the design of a new stored program computer,
referred to as the IAS computer, at the Princeton Institute for Advanced Studies. The IAS
computer, although not completed until 1952, is the prototype of all subsequent general-
purpose computers.
It consists of:
• A main memory, which stores both data and instructions1
• An arithmetic and logic unit (ALU) capable of operating on binary data
• A control unit, which interprets the instructions in memory and causes them to be executed
• Input and output (I/O) equipment operated by the control unit

9
Real Time and Embedded Systems (CoSc3026)

Figure: General structure of the IAS computer


The memory of the IAS consists of 1000 storage locations, called words, of 40 binary digits
(bits) each. Both data and instructions are stored there. Numbers are represented in binary form,
and each instruction is a binary code (Figure). Each number is represented by a sign bit and a
39-bit value. A word may also contain two 20-bit instructions, with each instruction consisting
of an 8-bit operation code (opcode) specifying the operation to be performed and a
12-bit address designating one of the words in memory (numbered from 0 to 999). The control
unit operates the IAS by fetching instructions from memory and executing them one at a time.

Figure: IAS Memory Formats

10
Real Time and Embedded Systems (CoSc3026)

Figure: Expanded Structure of IAS Computer


This figure reveals that both the control unit and the ALU contain storage locations, called
registers, defined as follows:
• Memory buffer register (MBR): Contains a word to be stored in memory or sent to the I/O
unit, or is used to receive a word from memory or from the I/O unit.
• Memory address register (MAR): Specifies the address in memory of the word to be written
from or read into the MBR.
• Instruction register (IR): Contains the 8-bit opcode instruction being executed.
• Instruction buffer register (IBR): Employed to hold temporarily the righthand instruction
from a word in memory.
• Program counter (PC): Contains the address of the next instruction-pair to be fetched from
memory.
• Accumulator (AC) and multiplier quotient (MQ): Employed to hold temporarily operands
and results of ALU operations. For example, the result of multiplying two 40-bit numbers is an
80-bit number; the most significant 40 bits are stored in the AC and the least significant in the
MQ.
The IAS operates by repetitively performing an instruction cycle. Each instruction cycle
consists of two sub-cycles. During the fetch cycle, the opcode of the next instruction is loaded
into the IR and the address portion is loaded into the MAR. This instruction may be taken from

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.

The real time systems have the following design components:

▪ 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:

▪ Interface handling with the external world


▪ Context switching after the measurement
▪ Prime response time
▪ Data management
▪ Resource allocation by priority
▪ Task synchronization and communication

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:

▪ Triggers and context switching on condition


▪ Concurrency of the data and processes
▪ Communication and synchronization
▪ Timing constraints attached to the tasks
▪ Coupling of the processes and actions

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.

• Real-time systems are compact, yet complex. Although a sophisticated real-time


system may contain well over 1 million lines of code, the time critical portion of the

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

Design Metrics / Design Parameters of an


Real Time Embedded System Function
Power Dissipation Always maintained low

Performance Should be high


The process/task should be completed within
Process Deadlines a specified time.

Manufacturing Cost Should be maintained.


It is the cost for the edit-test-debug of
Engineering Cost hardware and software.
Size is defined in terms of memory
RAM/ROM/Flash Memory/Physical
Size Memory.
It is the total time taken for developing a
Prototype system and testing it.
System safety should be taken like phone
locking, user safety like engine break down
Safety safety measure must be taken
Proper maintenance of the system must be
Maintenance taken, in order to avoid system failure.
It is the time taken for the product/system
Time to market developed to be launched into the market.

14

You might also like