Specifications

Chapter 2
Implementation of soft- and hardware
2.1 Real-Time OS
2.1.1 Soft and Hard Real-Time
With an ordinary Linux kernel it is not possible to handle interrupts for user processes with highest
performance. This implies that no Real-Time performance can be guaranteed. To make this possible
two kernel extensions are available, Real-Time Application Interface (RTAI) and RTLinux. Both the
extensions function in a similar way, with as important difference that RTAI is open-source freeware.
When Linux is patched with RTAI the operating system can be forced to handle the interrupts of user
processes with priority resulting in the highest performance possible. One often distinguishes the
interrupt handling of Linux and Linux RTAI as "Soft" Real-Time and "Hard" Real-Time.
For example: playing an audio or video file is Soft Real-Time, because few people will notice when
a sample comes a fraction of a second too late. Steering a space probe, on the other hand, requires
Hard Real-Time, because the rocket moves with a velocity of several kilometers per second such that
small delays in the steering signals add up to significant disturbances in the orbit which can cause
erroneous atmosphere entry situations.
It is obvious that the desired DACS for rapid (control) prototyping has to be Hard Real-Time. Like
in the steering of a space probe a small delay could cause instability in a mechanical system. Therefore
RTAI is used instead of RTLinux because RTAI is freeware. In the remainder of this report the term
Hard Real-Time is reduced to Real-Time.
2.1.2 RTAI
Using RTAI (or RTLinux) allows the execution of Real-Time tasks in a separate thread. This opens
up possibilities for scheduling Real-Time tasks. How this Real-Time performance is achieved can be
found from the RTAI programming Guide [9]:
"The Real-Time Linux scheduler treats the Linux operating system kernel as the idle
task. Linux only executes when there are no Real-Time tasks to run, and the Real-Time
kernel is inactive. The Linux task can never block interrupts or prevent itself from be-
ing preempted. The mechanism that makes this possible is the software emulation of
interrupt control hardware."
There are some intrinsic Real-Time features that are achieved by just executing Real-Time tasks in
kernel space:
Real-Time tasks (threads) are executed inside kernel memory space, which prevents threads to
be swapped-out.
Threads are executed in processor supervisor mode (i.e. ring level 0 in i386 arch), have full
access to the underlying hardware.
3