Professional Documents
Culture Documents
TN 324: Intelligent Instrumentation
TN 324: Intelligent Instrumentation
INSTRUMENTATION
Instructor: Mr. Mwalongo M, R
(Assistant Lecturer)
E-mail: mwalongomarko@gmail.com
LECTURE 4:
CONCEPTS OF REAL TIME SYSTEM
AND ITS APPLICATION
REAL TIME SYSTEM - INTRODUCTION
Real-time system is a system in which some specific work has to be
done in a specific time period. Or
Systems controlled by embedded software whose behavior is subject
to timing constraints.
o Timeliness is the single most important aspect of a real-time system.
o These systems respond to a series of external inputs, which arrive in
an unpredictable fashion.
o By definition Real-Time systems are as those systems in which the
correctness of the system depends not only on the logical result of
computation, but also on the time at which the results are produced.
If the timing constraints are not met, system failure is said to have
3
occurred.
REAL TIME SYSTEM - INTRODUCTION
o Note that the delivery of results at the correct time is the critical
distinguishing feature of a real-time system.
o In some ways, you could consider some systems such as
systems which pay salaries every month to be real-time systems
as they must complete their processing by the end of the month
so that people will be paid on time.
o However, we normally restrict the term real-time systems to
systems whose response time must be seconds or less.
4
REAL -TIME HISTORY
6
HARD REAL TIME SYSTEM
o The classical conception is that in a hard real-time system, the
completion of an operation after its deadline is considered useless
ultimately, this may lead to a critical failure of the complete
system or whose operation is incorrect if results are not produced
according to the timing specification.
o Example: For example consider systems that have to open a
valve within 30 milliseconds when the humidity crosses a
particular threshold. If the valve is not opened within
30milliseconds a catastrophe may occur. Such a systems with
strict deadline are called hard real-time systems.
o Another example, a car engine control system is a hard real-time
system because a delayed signal may cause engine failure or
damage.
7
SOFT REAL TIME SYSTEM
o A ‘soft’ real-time system is a system whose operation is degraded if
results are not produced according to the specified timing
requirements. On the other hand will tolerate such lateness, and
may respond with decreased service.
o Deadlines are imposed but not adhering to them once in a while
may not lead to the a catastrophe .
o Example for DVD player, suppose you give a command to DVD
player from remote control and there is a delay for few
milliseconds in executing that command but the delay won’t lead to
a serious implication, such system is called soft real-time systems.
8
SOFT REAL TIME SYSTEM
9
FIRM REAL TIME SYSTEM
Real-time facilities
Efficiency of execution 11
A REAL-TIME SYSTEM MODEL
12
A REAL-TIME SYSTEM MODEL. CONT.
14
STIMULUS/RESPONSE SYSTEMS
o A stimulus is an event which indicates that the system should take
some action.
17
ARCHITECTURAL CONSIDERATIONS
Real-time systems are usually designed as cooperating processes
with a real-time executive controlling these processes
research equipment.
21
REAL TIME OPERATING SYSTEM. CONT.
A RTOS facilitates the creation of a real-time system, but does not
guarantee the final result will be real-time; this requires correct
development of the software.
A RTOS does not necessarily have high throughput; rather, an RTOS
provides facilities which, if used properly, guarantee deadlines can
be met generally (soft real-time) or deterministically (hard real-
time).
A RTOS will typically use specialized scheduling algorithms in
order to provide the real-time developer with the tools necessary to
produce deterministic behaviour in the final system.
A RTOS is valued more for how quickly and/or predictably it can
respond to a particular event than for the given amount of work it
can perform over time. 22
REAL TIME OPERATING SYSTEM. CONT.
o Key factors in a RTOS are therefore minimal interrupt latency and a
minimal thread switching latency.
Must provide memory sharing threads
Must provide efficient tasking (context) switching
Should provide synchronization mechanism
Advanced RTOS may provide task scheduling
Examples for Real Time Operating System:
QNX, RTLinux, VxWorks and Windows CE (Read for more
23
details!!!)
DESCRIPTION OF REAL TIME OPERATING
SYSTEM
o Description of Real Time Operating System There are
additional fundamental aspects of RTOS design.
o One is the ability of a particular process to communicate with
another process (formally called interprocess communication
or IPC). This allows separate applications to interact with each
other and share the same data.
o The concept of IPC introduces another important operating
system aspect, preventing a process from changing data while
24
another process is using the data.
EXECUTIVE COMPONENTS:
Real-time clock
o A clock which ticks periodically (typically every few
Scheduler
o Decides which process should be run
Resource manager
o Allocates resources (e.g. memory) to the scheduled process
Dispatcher
o Starts execution of a process on a processor Scheduler
26
EXECUTIVE COMPONENTS: CONT.
Minimizing Latency
Latency
The time interval between the instant at which an instruction control unit
issues a call for data and the instant at which the transfer of data is
started.
Dispatch Latency
INTERRUPT LATENCY
o Interrupt latency is the period of time from when an interrupt
arrives at the CPU to when it is serviced
28
INTERRUPT LATENCY
Interrupt Latency
Period of time from arrival of interrupt to start of ISR (interrupt
service routine).
OS must complete process that was running + save the status of
the current process before switching.
Total time for the above tasks = interrupt latency
29
DISPATCH LATENCY
The amount of time required for the scheduling dispatcher to
stop one process and start another.
It must be minimum.
30
ASSIGNMENT
31
32