8/6/2019 Embd & RTos Overview
1/25
EmbeddedEmbedded andand RealReal--TimeTime
Operating SystemsOperating Systems
Overview
8/6/2019 Embd & RTos Overview
2/25
Embedded SystemsEmbedded Systems
An embedded system is a computer system
that is integrated into a larger system which is
not, itself, a general purpose computer.Basically it is a microprocessor-based system t
hat is built to control a function or a range of
functions.
Examples: Portable phone, washing machine
photocopier, aircraft's navigation
system, the cash dispenser etc.
8/6/2019 Embd & RTos Overview
3/25
ComponentsComponents
ofofEmbedded SystemsEmbedded Systems
CPU (Central Processing Unit)
Microprocessors are general purposeCPUs meant for general-purpose computer
applications .
Microcontroller consists of CPU, Memory
and set of I/O controllers within a single
chip.
8/6/2019 Embd & RTos Overview
4/25
Components ofComponents of
Embedded SystemsEmbedded Systems contd..contd.. Memory
RAM, ROM, Flash Memory, EPROM,
EEPROM.
I/O Controllers
Provide interface to external devices
Keyboard, display, printer, Digital Input,
Digital Output, Analog Input, Analog Output etc.
8/6/2019 Embd & RTos Overview
5/25
RealReal--Time SystemsSystems
A real-time system is a computer system
in which the correctness of the system
behavior depends not only on the logical
results of the computation, but also on the
physical instant at which these results areproduced.
8/6/2019 Embd & RTos Overview
6/25
Examples ofR-T systems Control of production processes / industrial a
utomation
Railway switching systems Automotive applications
Flight control systems
Environmental acquisition and monitoring
Robotics
Military systems
Space missions
8/6/2019 Embd & RTos Overview
7/25
Types ofR
eal Time Systems Soft R-T system :
Meeting its deadline is desirable
(for performance reasons) but missing does not
cause serious damage.
Examles:
Voice over IP, cellular telephony
Keyboard handling.
Display of video in a window where certain frames
missing wont effect the final display.
8/6/2019 Embd & RTos Overview
8/25
Types ofReal Time Systems contd..
HardR-T system:
Missing its deadline may cause catastrop
hicconsequences on the environment under
control.
Examples:
Sensory data acquisition. Auto Pilot Flight control system and Rocket control.
Automotive air-bag control.
Control robots used in various automatic processes.
8/6/2019 Embd & RTos Overview
9/25
Real Time Operating SystemsReal Time Operating Systems
FromPOSIX 1003.1b:
Realtime in operating systems is
the ability of the operating system to provide arequired level of service in a bounded response time.
RTOS is a system, which satisfies the following
conditions: Responds in a predictable way to unpredictable
external events.
Strict timing constraints.
8/6/2019 Embd & RTos Overview
10/25
Features ofanRTOS
Timeliness
Predictability Priority based preemptive scheduling
Task synchronization mechanisms
Interrupt handling ISRs
Priority Inheritance should exist
8/6/2019 Embd & RTos Overview
11/25
Timeliness
OS has to provide mechanisms for:
time management
handling tasks with explicit time constraints
Achieved through proper scheduling algorithms.
Predictability
Provide timing details for execution ofevery system call, Context Switching, Interru
pt Latency.
8/6/2019 Embd & RTos Overview
12/25
Multitasking and Scheduling
Round-robin Scheduling
Shares theCPU fairly among all ready
tasks of the same priority.
Preemptive Priority Scheduling
Each task has a priority.
CPU is fairly allocated to the highest
priority task that is ready to run.
8/6/2019 Embd & RTos Overview
13/25
Interrupt Handling
Handling of the hardware interrupts by the kernel is
the most critical factor contributing to the determinism
and overall responsiveness of real-time system.
Bottom half handlers:
Off-loading interrupt
processing from the
interrupt handler to a
separately scheduled task.
The system is able to respond to subsequent
interrupts sooner, thus reducing the worst case
interrupt latency
.
8/6/2019 Embd & RTos Overview
14/25
Interrupt Handling contd..contd..
Bottom half handlers are scheduled before all user
tasks i.e, all interrupt processing runs at a higher
priority than all user tasks, including real-time processes.
Interrupt Latency:Measure of the ability of RTOS to respond to the
hardware interrupts.
The time from the start of the physical interrupt to theexecution of the first instruction of the interrupt service
routine.
8/6/2019 Embd & RTos Overview
15/25
Latency
The latency (or tardiness) of a task is the difference bet-ween the instant of time on which the task should have
started (or finished) and the instant of time on which it
actually did.
Latencies are due to several factors:
(i) The timing properties of processor, bus, memory
and peripheral devices,
(ii) The scheduling properties of theRTOS,
(iii) The pre-emptive ness of the OS kernel, and
(iv) The load on the system (i.e., the number of tasks
that want to be scheduled concurrently).
The statistical distribution of the latencies in the
subsequent scheduling of tasks is called the
scheduling jitter.
8/6/2019 Embd & RTos Overview
16/25
Thread Switch Latency
An important contribution to the latency is the context
switch time of the processor; i.e., the time needed to
save the local data of the currently running task
(e.g., the contents of the processor registers; the
stack of the task; the current instruction pointer), and to
replace it with the local data of the newly scheduled task
Def: The time from the execution of the last
instruction of one user-level task to the first
instruction of the next user-level task.
8/6/2019 Embd & RTos Overview
17/25
Priority Inversion : Higher-priority task is
forced to wait an indefinite period for a lower-p
riority task to complete.
Priority Inheritance :
Eliminates the risk of unbounded
priorty inversion.
The lower priority task temporarilyinherits the priority of the higher until it
relinquishes the resource, and returns
to its original priority.
8/6/2019 Embd & RTos Overview
18/25
Monolithic kernelMonolithic kernel
vsvs
MicroMicro--kernelkernel A monolithic kernel has all OS services running within t
he privileged mode of the processor. (This doesnt
mean that the whole kernel is one singleC file!).
A micro-kernel, on the other hand, uses theCPUs
privileged mode only for really core services
(task scheduling, interprocess communication and
memory allocation), and has most of the device
drivers and OS services running as normal tasks.
8/6/2019 Embd & RTos Overview
19/25
Kernel spaceKernel spacevsvs
user spaceuser space Most modern processors allow programs
to run in two different privilege(i.e., hardware
protection) levels.
user space have more protection against
erroneous accesses to physical memory of
I/O devices,but access most of the hardware with larger latencies than kernels space
tasks.
8/6/2019 Embd & RTos Overview
20/25
PrePre--emptive kernelemptive kernelvsvs
nonnon--prepre--emptive kernelemptive kernel
In a non-pre-emptive kernel, a kernel space
task cannot be interrupted by other kernelspace tasks, or by user space tasks.
This makes the design of the kernel simpler,but introduces in-deterministic latencies
which are not tolerable in a RTOS.
8/6/2019 Embd & RTos Overview
21/25
Memory managementvs
Shared memory space irtual memory and dynamic allocation and
de-allocation of memory pages induces
overhead,and some simpler processors have no s
upport for this memory management.
In Real-time kernels all tasks share the same memory space, such that developers must
take care of the proper use of that memory.
8/6/2019 Embd & RTos Overview
22/25
RTOS Available
Proprietary
VxWorks by WindRiver
LynxOS by Lynx
Free/Open-source
RedHats eCos
RTLinux QNX
uC/os
RTEM
8/6/2019 Embd & RTos Overview
23/25
RTOS useRTOS use aerospace & defenceaerospace & defence
Aerospace & Defence Sector
RTOS Use Characteristics
(% Respondents: 1348 Total)
Don't Use RTOS
34,2%
RTE S
0,1%
C/OS0,4%
RT-Linux
0,8%
pSOS
6,7%
QNX
4,5%
Tornado/VX-Works
16,7%
WinCE
0,7%
Proprietary
7,1%
WinNT
3,3%Other Commercial
25,4%
8/6/2019 Embd & RTos Overview
24/25
VxWorks vs RTLinux
Context Switch (S)VxWorks 11 (0.04)
RTLinux 13.4 (0.6)
Priority
Inversion (S)VxWorks 123 (1.67) RTLinux 108 (0.41)
Interrupt Latency (S)VxWorks 98 (0.55)
RTL
inux 132 (1.2)
Overall analysis shows that both operating systems are
suitable for real-time application.
In particular, VxWorks is more deterministic and predictable.
8/6/2019 Embd & RTos Overview
25/25