RTOS
RTOS
1. Introduction
2
Real Time Operating System
· Firm: Firm real-time systems have hard deadlines, but where a certain low
probability of missing a deadline can be tolerated.Most real-time systems
interface with and control hardware directly.The software for such systems is
mostly custom-developed. Real-time Applications can be either embedded
applications or non-embedded (desktop) applications. Real-time systems often
do not have standard peripherals associated with a desktop computer, namely
the keyboard,mouse or conventional display monitors. In most instances, real-
time systems have a customized version of these devices.
3
Real Time Operating System
4
Real Time Operating System
Within the exception of these few common features, rest of the embedded
hardware is usually unique and varies from application to application. Each
system must meet a completely different set of requirements.The common
critical features and design requirements of an embedded hardware include:
2. Throughput: The system may need to handle a lot of data in a short period
of time.
4. Memory: Hardware designer must make his best estimate of the memory
requirement and must make provision for expansion.
6. Number of units: the no. of units expected to be produced and sold will
dictate the Trade-off between production cost and development cost.
5
Real Time Operating System
9. Test & Debug ability: setting up test conditions and equipment will be
difficult and finding out what is wrong with the software will become a
difficult task without a keyboard and the usual display screen.
6
Real Time Operating System
(iv) Sufficient Priority Levels: When using prioritized task scheduling,the RTOS
must have a sufficient number of priority levels, for effective implementation.
Priority inversion occurs when a higher priority task must wait on a lower
priority task to release a resource and in turn the lower priority task is waiting
upon a medium priority task. Two workarounds in dealing with priority
inversion, namely priority inheritance and priority ceiling protocols (PCP), need
sufficient priority levels. In a priority inheritance mechanism, a task blocking a
higher priority task inherits the higher priority for the duration of the blocked
task. In PCP, a priority is associated with each resource which is one more than
the priority of its highest priority user. The scheduler makes the priority of the
accessing task equal to that of the resource. After a task releases a resource, its
priority is returned to its original value. However, when a task’s priority is
increased to access a resource it should not have been waiting on another
resource.
(v) Predefined latencies: The timing of system calls must be defined using the
following specifications:
• Task switching latency or the time to save the context of a currently executing
task and switch to another.
7
Real Time Operating System
• Interrupt latency or the time elapsed between the execution of the last
instruction of the interrupted task and the first instruction of the interrupt
handler.
• Interrupt dispatch latency or the time to switch from the last instruction in the
interrupt handler to the next task scheduled to run.
8
Real Time Operating System
task schedules statically determined. Two common constraints in scheduling
are the resource requirements and the precedence of execution of the tasks.
Typical parameters associated with tasks are:
• Average execution time
• Worst case execution time
• Dispatch costs
• Arrival time
• Period (for periodic tasks).
(i) Static table driven: The feasibility and schedule are determined
statically. A common example is the cyclic executive, which is also
used in many large-scale dynamic real-time systems. It assigns tasks
to periodic time slots. Within each period, tasks are dispatched
according to a table that lists the order to execute tasks. For periodic
tasks, there exists a feasible schedule if and only if there is a feasible
schedule within the least common multiple of the periods. A
disadvantage of this approach is that a-priori knowledge of the
maximum requirements of tasks in each cycle is necessary.
9
Real Time Operating System
(iii) Dynamic planning based: The feasibility analysis is conducted
dynamically—an arriving task is accepted for execution only when
feasible.The feasibility analysis is also a source for schedules. The
execution of a task is guaranteed by knowing its worst-case execution
time and faults in the system. Tasks are dispatched to sites by
brokering resources in a centralized fashion or via bids. A technique
using both centralized and bidding-approach performs marginally
better than any one of them but is more complex.
(v) Scheduling with fault tolerance: A primary schedule will run by the
deadline if there is no failure and a secondary schedule will run by the
deadline on failure. Such a technique allows graceful degradation but
incurs cost of running another schedule. In hard real-time systems,
worst-case blocking must be minimized for fault tolerance.
(vi) Scheduling with resource reclaiming: The actual task execution time
may be shorter than the one determined a-priori because of
conditionals or worst-case execution assumptions. The task dispatcher
may try to reclaim such slacks, to the benefit of non real-time tasks or
improved timeliness guarantees.
10
Real Time Operating System
5. Case Studies
Some of the popular RTOSs are reviewed here to identify their salient
features which make them suitable for different embedded real-time
applications. One of the General Purpose Operating Systems is also discussed
here to highlight why a General Purpose Operating System is not suitable for
real-time applications.
The QNX RTOS v6.1 has a client-server based architecture. QNX adopts
the approach of implementing an OS with a 10 Kbytes micro-kernel surrounded
by a team of optional processes that provide higher-level OS services .Every
process including the device driver has its own virtual memory space. The
system can be distributed over several nodes, and is network transparent. The
system performance is fast and predictable and is robust.
5.2 VRTX
11
Real Time Operating System
configurable. The configuration of CE 3.0 is a complicated process. The
documentation does not give in depth knowledge about inner workings of the
system though the APIs are well documented.The system is robust and no
memory leak occurs even under stressed conditions. CE 3.0 uses virtual
memory protection to protect itself against faulty applications.
5.6 Windows NT
The overall architecture is good and may be a suitable RTOS for control
systems that need a good user interface and can tolerate the heavy recourse
requirements demanded for installation. It needs hard disk and a powerful
processor. Configuration and user interaction requires a dedicated screen and
keyboard. The choice of selecting components for installation is limited and it is
not possible to load and unload major components dynamically. Because of all
12
Real Time Operating System
these limitations Windows NT not suitable for embedded applications. It is
neither suitable for other real time applications because of the following factors:
a) There are only 7 priority levels & there is no mechanism to avoid priority
inversion
c) Though ISR responses are fast, the Deferred Procedure Calls (DPC) handling
is a problem since they are managed in a FIFO order.
d) The thread switch latency is high (~ 1.2 ms), which is not acceptable in many
real-time applications.
5.8 Predictability
13
Real Time Operating System
requirements are met subject to any assumptions made, for example,
concerning failures and workloads. In other words predictability is always
subject to the underlying assumptions made.
14
Real Time Operating System
When systems have become larger and unwieldy, they are difficult
to comprehend, develop and maintain.
15
Real Time Operating System
process management and synchronization
memory management
inter process communication
I/O
has to be short and the scheduling algorithm to be executed must be fast and
very simple.
16
Real Time Operating System
research kernels.
The small, proprietary kernels are often used for small embedded
systems when very fast and highly predictable execution must be guaranteed.
The kernels are often stripped down and optimized to reduce the run-time
overhead caused by the kernel. The usual characteristics of these kernels are:
17
Real Time Operating System
all timing constraints are met. As complexity of the system increases, it
becomes more and more difficult to map all timing, computation time, resource,
and value requirements to a single priority for each task. In these situations
demonstrating predictability becomes very difficult. Because of these reasons,
some researchers believe, that more sophisticated kernels are needed to address
timing and fault tolerance constraints. Recently there are efforts to produce
scalable kernels. The smallest level of support is a microkernel, and the support
can be broaden by demands of the application. An example of this type of
kernel is the Chorus microkernel [9], which can be scaled from a simple
embedded microkernel to a full POSIX/UNIX support.
18
Real Time Operating System
8. Conclusion
Real time Operating systems play a major role in the field of embedded
systems especially for mission critical applications are involved.Selection of a
particular RTOS for an application can be made only after a thorough study of
the features provided by the RTOS.
19
Real Time Operating System
9. Bibliography
20