Page 270 - Embedded Microprocessor Systems Real World Design
P. 270
An RTOS typically is used when the system needs shared resources, needs to
allocate memory, or when operation is at a sufficiently high level to justify the RTOS
overhead. In general, if the system is complicated but tasks can be scheduled at the
resolution of the timer tick, an RTOS may make sense. Even in simple systems, an
RTOS may be used to structure code execution. An RTOS also makes sense if you
need standard resources (disk drives, VGA display, and so on) for which you want
off-the-shelf drivers.
An RTOS is suitable any time the number of tasks is such that sequential
scheduling is unable to ensure that the highest-priority jobs are done first. Using
preemptive scheduling, an RTOS can make sure that the important functions get
done on time.
Many RTOSs are configurable-you start with the basic kernel and add whatever
features you need. If you have disk drives, you might add the RTOS module that
includes disk drivers. Ethernet support or TCP/IP might be another module. If you
need features such as TCP/IP support, you might choose to use an RTOS just to
simplify software development. An RTOS lets you write code that interfaces to the
TCP/IP stack and to other devices at a higher level. You can avoid writing your own
device drivers, interface protocol stacks, and so on. In many systems, this alone is
sufficient reason to justify using an RTOS.
When you consider an RTOS, look at the cost. Some RTOSs have a one-time
purchase fee, whereas others charge a license for every copy used. Sometimes you
pay a sliding license fee, starting with a basic fee for the kernel and increasing as
you add RTOS modules (such as TCP/IP support). License fees can get quite
expensive, especially if your system has multiple processors needing an RTOS.
While the division between an RTOS and a kernel is not a fine line, generally, a
kernel is smaller than a corresponding RTOS. While not providing all the features
of the full RTOS, the kernel can provide scheduling and management functions
suitable for small embedded systems that cannot support or do not need the
overhead of a full RTOS.
Using an RTOS often means needing more memory, since each task will have
its own stack. Some RTOSs are linked into your code, whereas others are like a PC
operating system: The RTOS loads from a storage device and your program runs
as an application. Which RTOS you choose can have a big impact on the hardware;
you need whatever basic resources the RTOS requires to operate.
Communication standards also are important. Many RTOSs now support
TCP/IP, for example. If you use a standard interface such as this, you can com-
municate with any other system that uses the same standard protocol, regardless of
what operating system it uses.
Although most RTOSs are available only for high performance CPUs such as
the Intel Pentium and Motorola PowerPC, there are some exceptions. CMX-RTX
from CMX Systems is available for many microprocessors and microcontrollcrs,
Real-Time Operating Systems 251