Architecture of RTOS
An RTOS usually comprises only a kernel. For
more complex embedded systems, an RTOS
can be a combination of various modules,
including the kernel, networking protocol
stacks, and other components as illustrated
An operating system generally consists of two
parts: kernel space (kernel mode) and user
space (user mode).
The kernel of an RTOS
provides an abstraction
layer between the
This abstraction layer
comprises of six main
types of common
services provided by the
kernel to the
There are three broad categories of kernel models available
E.g.. Examples are Linux
E.g. Examples are
AmigaOS and QNX
E.g.. library operating
Classification Of RTOS
Hard real time
Firm real time
Zero degree of
E.g. Automobile engine
control system and anti
lock brake, video
transmission, each picture
audio must be transferred
at fixed rate.
Soft real time
E.g. a food processing
plant control system.
E.g. Mobile phone, digital
cameras and orchestra
Features Of RTOS
Non Pre emptive
Task and Multitask
E.g.20 MHz 68000 process
or task switch times are
roughly 20 microseconds.
In contrast, a
100 MHz ARM CPU
switches in less than 3
a)Can concentrate all the
talent at a particular task.
b)Debugging is simple.
c)Easy to understand.
Pre emptive Scheduler
It allows high priority task to
run first and move low
priority task which is in
running into ready state.
E.g. Solaris 2.0/SunOS
5.0, Windows NT, the Linux
kernel 2.6 and 3.x, AIX and
some BSD systems (NetBSD,
since version 5), Anroid.
High priority task executed
Non Pre emptive
High priority task co
operate with low priority
E.g. Windows3.1x, Mac
Easy to implement.
High priority task has to
wait for low priority task
to complete, thus, not
suitable for RTOS.
E.g. In μC/OS-II, for a task to delay itself:
OSTimeDly(ticks), where ticks is the number of
clock ticks from the timer;
OSTimeDlyHMSM(H,M,S,M), with Hours, Minutes,
E.g. µC/OS-II use system clock, Vx Works use
Memory allocated for
Memory allocated for
each task control
Size of queue.
Size of mailbox
Size of pipe
Inter task Communication
Shared Data Protected
Event objects are used when task synchronization is required without resource
sharing. They allow one or more tasks to
keep waiting for a specified event to occur.
E.g. AVR microcontroller, Linux 2.4; Windows
NT/XP/Vista, Mac OS X uses a multilevel feedback
queue, uses a Multilevel feedback queue.
E.g. TI SYS/BIOS v6.33 RTOS, Keil RTX.
E.g. QNX RTOS, SMX RTOS.
Whenever it is set, shared data is free.
whenever it is reset shared data is busy.
Whenever a task access shared data it takes
semaphore and the semaphore flag is reset.
Whenever a task exit from shared data it releases
semaphore and the flag is reset.
In this way shared data is protected.
It is semaphore in which value can be
incremented or decremented. it is unsigned
This semaphore can be taken multiple times.
Taking semaphore means decrementing the
Releasing the semaphore means incrementing
E.g. ChibiOS/RT, VxWorks, CHIP-RTOS-x86 RTX
Spin lock Semaphore
This semaphore will not make running task to
Spin lock is useful in following situation:
Suppose low priority task is running and only some
time is left for its completion.
Now high priority task wants to run
Now RTOS provides spin lock semaphore to the high
priority task and so it can spin for some time. During
that time low priority task is executed and by itself it
is moved into blocked state.
Now high priority task begins to run.
Size of ISR:
If ISR is long, then there are two drawbacks:
Highest priority task is blocked for more time.
ISR is sensitive to error and so it is difficult to debug long
Size of ISR should be small.
Can concentrate all talent at a particular task.
Debugging is simple.
Very easy to understand.
More memory needed because each task needs memory.
Speed is less because task switching needs more time.
Number of tasks should be moderate.
creating and destroying task:
It is time consuming and thus speed becomes less.
Must avoid this.
Task designing should be such that task is blocked at the most
only one place.
Keep time slicing off:
Task should not have equal priority.
to save memory:
For each task provide stack memory, TCB etc. only as much
Limit RTOS services.
Do not use same function that does nearly same action.
Techniques to save power:
Power down mode.
Low power mode.
hardware with task:
This type of task is known as sever task.
If hardware is having many tasks, then we must have
separate task to encapsulate the hardware.
This separate task is known as server task.
Whenever task has to access hardware, they give
message in the queue to the server task.
Then server task makes accessing the hardware in
Run time facilities i.e. provision of kernel services.
Provision for interrupts.
Task can have priority.
This architecture can suspend low priority task
and make high priority task run immediately
when need arises.
Supplier stability/ longevity.
Availability of Development tools.
MRI(Magnetic Resonance Machine)
a) automatic breaking systems.
b) fuel injection.
c) path tracking.