Military Embedded Systems Spring 2005 Volume 1 Number 1
Military Embedded Systems Spring 2005 Volume 1 Number 1
Military Embedded Systems Spring 2005 Volume 1 Number 1
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Software<br />
MILITARY EMBEDDED SYSTEMS Resource Guide<br />
What is real time and<br />
why do I need it?<br />
By Steve Furr<br />
Not all systems need an RTOS; but of<br />
those that do, does the designer know<br />
what about the system is “real time”?<br />
An RTOS can play a key role in determining<br />
how a system runs, and it’s<br />
critical to choose an RTOS based upon<br />
system requirements.<br />
Real time is a sometimes misunderstood<br />
and misapplied property of operating systems.<br />
Moreover, there is often disagreement<br />
as to when a Real-Time Operating<br />
System (RTOS) is needed. For instance,<br />
when designing an industrial control<br />
system or medical instrument, most engineers<br />
and system designers would concur<br />
that an RTOS is necessary. However,<br />
questions arise, when it comes to other<br />
applications, such as tracking systems<br />
and a variety of in-vehicle devices. Is an<br />
RTOS needed here? Or would a generalpurpose<br />
OS such as Linux or Windows do<br />
the job? Often, such systems do require<br />
an RTOS, but the issue isn’t recognized<br />
until later in the design phase.<br />
Therefore, it’s important to understand<br />
why the real-time capabilities provided<br />
by an RTOS are not only beneficial, but<br />
necessary for a wide variety of embedded<br />
systems. For instance, consider a system<br />
where users expect or need immediate<br />
feedback to input. With an RTOS, a developer<br />
can ensure that the system always<br />
provides feedback in a timely fashion,<br />
even when the system is handling many<br />
other compute-intensive activities. The<br />
user is never left wondering whether the<br />
system has, in fact, accepted the button<br />
push or recognized the voice command.<br />
In a nutshell, an RTOS allows developers<br />
to control how long a system will take<br />
to perform a task or respond to critical<br />
events. Deadlines can be met within predictable,<br />
and wholly consistent, timelines,<br />
even under heavy system loads.<br />
What, exactly, is real time?<br />
To appreciate what real time is, what it<br />
isn’t, and why it’s beneficial, let us start<br />
with a basic definition of a real-time system,<br />
as defined in the Frequently Asked<br />
Questions for the comp.realtime newsgroup<br />
(news://comp.realtime or groupsbeta.google.com/group/comp.realtime):<br />
“A real-time system is one in which the<br />
correctness of the computations not only<br />
depends upon the logical correctness of<br />
the computation but also upon the time at<br />
which the result is produced. If the timing<br />
constraints of the system are not met, system<br />
failure is said to have occurred.”<br />
Real time, then, is a property of systems<br />
where time is literally of the essence. In a<br />
real-time system, the value of a computation<br />
depends on how timely the answer is.<br />
For example, a computation that is completed<br />
late has a diminishing value, or<br />
no value whatsoever, and a computation<br />
completed early is of no extra value. Real<br />
time is always a matter of degree, since<br />
even batch computing systems have a real<br />
time aspect to them. Nobody wants to get<br />
their payroll deposit two weeks late!<br />
Problems arise when many activities compete<br />
for a system’s resources; in fact, this<br />
is where we begin to apply the real-time<br />
property to operating systems. In implementing<br />
any real-time system, a critical<br />
step in the process will be the determination<br />
of a schedule of activities that enables<br />
all activities to be completed on time.<br />
Any real-time system will comprise different<br />
types of activities: those that can be<br />
scheduled, those that cannot be scheduled<br />
(for example, operating system facilities<br />
and interrupt handlers), and non real-time<br />
activities. If non-schedulable activities<br />
can execute in preference to schedulable<br />
activities, they will affect the ability of the<br />
system to handle time constraints.<br />
Hard vs. soft real time<br />
Often, a distinction is made between hard<br />
and soft real time. A hard real-time constraint<br />
is one for which there is no value<br />
to a computation if it is late and where<br />
the effects of a late computation may be<br />
catastrophic. Simply put, a hard real-time<br />
system is one where all activities must be<br />
completed on time. A flight control system<br />
is a good example.<br />
On the other hand, soft real time is a property<br />
of the timeliness of a computation<br />
where the value diminishes according to<br />
its tardiness. A soft real-time system can<br />
tolerate some late answers to soft realtime<br />
computations, as long as the value<br />
hasn’t diminished to zero. Deadlines may<br />
be missed, but the number and frequency<br />
of such misses must typically comply<br />
with Quality of Service (QoS) metrics.<br />
Frequently, soft real time is erroneously<br />
applied to OSs that cannot guarantee<br />
computations will be completed on time.<br />
Such OSs are best described as quasi real<br />
time or pseudo real time OSs in that they<br />
execute real-time activities in preference<br />
to others whenever necessary, but don’t<br />
adequately account for non-schedulable<br />
activities in the system. Put simply, soft<br />
real time shouldn’t be confused with non<br />
real-time.<br />
Positive impact<br />
Traditionally, RTOSs have been used in<br />
hard real-time environments where failure<br />
to perform activities in a timely manner<br />
can result in harm to persons or property.<br />
But an RTOS can be just as useful<br />
for applications that must meet QoS guarantees,<br />
particularly when failure to do<br />
so could result in financial penalty. This<br />
covers obvious service scenarios, such<br />
as “30 minutes or it’s free,” but it also<br />
includes intangible penalties, such as lost<br />
opportunities or loss of market share.<br />
Moreover, real-time technology can be<br />
applied to conventional systems in ways<br />
that positively impact the user experience,<br />
either by improving the perceived<br />
response to certain events or by ensuring<br />
that important activities execute preferentially<br />
with respect to others in the system.<br />
For instance, consider a device that pres-<br />
36 / <strong>2005</strong> MILITARY EMBEDDED SYSTEMS Resource Guide