Академический Документы
Профессиональный Документы
Культура Документы
Embedded Linux® –
Ready for Real-Time
Prepared by
Bill Weinberg, MontaVista Software Inc.
1
Title of White Paper
Copyright © 2001 MontaVista Software, Inc. All rights reserved. DATE
Embedded Linux – Ready for Real-Time – White Paper
Table of Contents
Introduction ..................................................................... 4
Embedded and Real-Time: Identity Crisis? .................... 4
Four Paths to Real-Time Linux ....................................... 6
Conclusion .................................................................... 10
Abstract
Embedded Linux –
Ready for Real-Time
Bill Weinberg and Claes Lundholm
1. Introduction
Embedded Linux is upsetting the established order in the development tools marketplace.
Developers are choosing Linux over traditional proprietary RTOS products for its superior
reliability, for its cost effectiveness, and for its open source and standard APIs. After almost 20
years of using products like VRTX, pSOS, and VxWorks, developers are eager to embrace Linux,
but express reservations about its ability to address real-time performance requirements. This
article responds to such concerns about Linux performance, questioning some basic assumptions
about embedded and real-time, and describing how Linux can be applied to solve a variety of
real-time problems.
Figure 1.: Popular assumptions about Embedded and Real-Time – a large intersection
Embedded equals real-time, real-time equals embedded – you can use the “other guys’” OS if
you don’t really have a real-time need.
In the authors’ experience, investigation of actual developer’s requirements paints a different
picture – perhaps 10-15% of all embedded applications have a any real-time requirement, and
perhaps half of those applications actually have a demonstrable need for hard real-time.
Figure 2.: Market reality – most embedded designs are non or soft real-time
Moreover, many truly hard real-time applications fall outside the domain of traditional embedded.
The remaining majority of embedded applications benefits from responsiveness, but relies on
throughput to achieve design goals – “real-fast” or “just fast enough” suffices.
Many developers, regardless of the actual hard or soft real-time needs of their application,
choose to design in an RTOS as insurance, both against unanticipated current responsiveness
needs, and against anticipated future ones.
• Just like typical GPOS (General Purpose OS) products, most RTOSes do not scale well, and
display both longer latencies and increased jitter as the number to tasks and other managed
objects increases.
• One very popular RTOS suffers from increasingly non-deterministic memory allocation
performance over time, as its malloc-derived management scheme succumbs to ever-greater
fragmentation and free-list walking times.
• Another, UNIX-like RTOS touts its message-based microkernel architecture, while its complex
internal state(s) and driver architecture render it incapable of delivering deterministic response
times.
• Many RTOS file systems, despite boasts of “real-time” features like contiguous files and raw
partition access, offer lack-luster throughput and jittery response.
• Several embedded operating systems that offer MMU-based memory protection introduce
significant jitter from both TLB spills and from poor implementation of process/thread memory
model context switches. This deficit is especially evident on low-end PowerPC processors like the
PowerQUICC (Linux happens to handle these CPUs very well!).
n
Execution pti o
em
Flow e-
Non-Preemptible
Non-Preemptible
Pr
Linux
Linux Kernel
Kernel
Scheduler(s)
Scheduler(s)
System Call
Moreover, the Linux kernel itself is non-preemptible (again, to enhance throughput), with relatively
long blocking times – no rescheduling can take place until the kernel completes a system call or
other internal activity and prepares to return control to the calling context.
Given this history and these design constraints, let us examine how and when to use Linux in
applications previously considered the exclusive domain of the above MOLRTOSes (More Or
Less RTOSes).
Linux device drivers present developers with both a rich, tantalizing set of off-the-shelf resources,
and a potential performance trap, when those same drivers turn out to be sub-optimal, with
lengthy interrupt blocking times or other architectural flaws. The good news is that the Linux
driver model is inherently sound – even quick-and-dirty Linux drivers exhibit decent performance
(e.g., network interface drivers). And, while some might consider driver-writing a “black art”, at
least the scope of tunable code is highly constrained in function and size.
The key is to audit ALL drivers that you design into a system to insure that no one driver is a
bottleneck. Linux facilitates such audits and testing, first by being open source, and second by
featuring a dynamically installable kernel module/device driver architecture.
hard prioritization, but does not address the issue of kernel preemption, and so only offers soft
real-time responsiveness.
Figure 4.: Audible glitching from loading a stock Linux 2.4 kernel while streaming audio
(the red line at 3 ms represents audible effects)
Figure 5.: Minimal jitter from loading a preemptible Linux 2.4 kernel while streaming audio
With preemption enabled, these delays are vastly reduced, with no audible distortion (Figure 5.).
5.0 Conclusion
Linux, is undeniably changing the face of embedded development and pervasive computing.
While past instances of UNIX-type operating systems, including standard Linux itself, were
arguably inappropriate for embedded and real-time (size, speed, storage, CPU support),
embedded Linux is proving itself to be scalable and sprightly enough for up to 95% of embedded
developers real-time requirements.
Multiple options exist for imbuing embedded Linux with more deterministic response
characteristics. With the advent of fully preemptible, open source kernel configurations/builds like
those from MontaVista, developers with real-time needs and a desire to build their applications on
an open platform like Linux, can enjoy enhanced determinism without giving up the open APIs
and broadly supported core architecture that drew them to Linux in the first place
NOTES:
Corporate Headquarters
United States
MontaVista Software, Inc.
1237 East Arques Ave.
Sunnyvale, CA 94085
Tel : (408) 328-9200
Fax : (408) 328-9204
email: sales@mvista.com
http://www.mvista.com
Sweden
MontaVista Software AB
Tel: +46 8 527 570 00
email: info-se@mvista.com
UK
MontaVista Software Limited
Tel: 08709 010870
email: info-uk@mvista.com
Copyright © 2001 MontaVista Software, Inc. All rights reserved. MontaVista Linux is a trademark of MontaVista Software, Inc. Linux is a registered trademark of Linus
Torvalds. All other trademarks are the property of their respective owners.