| Introducing MediaLinux -- a new real-time Linux approach |
by Eatamar Drory and Or Sagi (Nov. 11, 2003)
Foreword: Last week, Softier made news with one of the first native ports of Linux to a Digital Signal Processor (DSP) architecture, introducing its "MediaLinux" and "MediaBIOS" for TI's DM64x DSP platform. In this article, Softier CTO Eatamar Drory and Senior Programmer Or Sagi discuss the unique approach to real-time processing that enables MediaLinux to run existing TI DSP algorithms untouched within the context of real time processes. Added benefits to this design include predictable scheduling and short interrupt latency. The article discusses key architectural points of the MediaLinux approach in comparison with two well-known alternatives.
Symmetrical Hosting -- the MediaLinux Approach by Eatamar Drory and Or Sagi Softier's MediaLinux (GPLed) architecture is called "Symmetrical Hosting," as there is no distinction between real-time and non-real-time processes. MediaLinux, a standard uClinux based kernel (currently 2.4.20), is hosted on the (non-GPL) MediaBIOS infrastructure.
MediaBIOS provides OS components, a BSP (board support package), run-time optimized utilities such as a relocatable COFF loader and flash utilities, VLIW optimized functions, and an interface to encapsulated media processing.
MediaBIOS was developed as a general purpose real-time media processing framework, enabling a wide variety of hosting operating systems to easily migrate to the unique architecture of TI's VLIW DSP. MediaBIOS's design goal was to preserve TI's investment in media processing algorithms (Audio/Video) and to allow them to run unmodified based on compliance with TI eXpressDSP design rules. As a result, developers can take advantage of hundreds of available third party algorithms (such as MPEG1/2/4, MP3, AAC, etc.).
MediaLinux was designed to stay current with main-line Linux, rather than create a new modified branch. Its architecture is based on implementing every Linux process as a MediaBIOS task, such that there is no distinction between real-time and non-real-time tasks (the symmetrical approach).
This approach is illustrated next:
 Figure 1: MediaLinux Real Time Approach -- Symmetrical Hosting
Handling of real-time issues in Linux involves two consecutive paths of execution: the first path being from the event (interrupt, signal, etc) until entering the scheduler; the second path being from invocation of the scheduler until the corresponding real-time destination begins running.
MediaLinux's added real-time feature, "Context Agnostic Scheduling" (CAS), takes advantage of the symmetric OS implementation. This allows invocation of the MediaLinux scheduler from any context, yielding a constant guaranteed latency for the first scheduling phase of delivering an event. The actual implementation uses the underlying optimized MediaBIOS scheduler to perform the context switch under control of the Linux scheduler. This solves the latency issue of the first phase scheduling process. In the second phase of the scheduling process, kernel readiness issues to perform a context switch at any given point in time are addressed by standard Open Source industry preemption patches, which are also applicable to MediaLinux.
Key Points of the Symmetrical Hosting approach:- Softier real-time design
- Every Linux process is implemented via an underlying MediaBIOS process
- No distinction between real-time and non real-time tasks (symmetric)
- All system resources including interrupt handling, are under Linux kernel control
- Includes "Context Agnostic Scheduling"
- Single OS (standard Linux)
- Can selectively employ "Preemption Improvement" kernel real-time patches
- Not an "Interrupt Abstraction"
The Alternatives
Preemption Improvement
The "Preemption Improvement" approach strives to reduce process latency and make the Linux kernel more responsive by introducing more preemption points. This is achieved by reversing the standard Linux preemption strategy, which prevents preemption unless specifically allowed. Instead, "Preemption Improvement" allows preemption at all times, unless a newly defined method, namely an extension of the current SMP "spinlock" mechanism, protects critical sections and prevents preemption. This approach is illustrated below:
 Figure 2: Mainstream Linux Real Time Approach -- Preemption Improvement
"Preemption Improvement" also incorporates modifications to interrupt handling. This permits preemption on return from interrupts; improving the scheduling time by introducing a new scheduling algorithm with a fixed overhead. It should be noted that this approach improves system responsiveness and reduces latency. However, it cannot guarantee true real-time latency characteristics, as the execution path is complex and prevents deterministic conclusions.
Key Points of the Preemption Improvement approach:- Major contributors: MontaVista, TimeSys
- Allows scheduling on return from interrupt
- Based on controlled preemption prevention
- No distinction between real-time and non real-time processes
- Requires modifications to the Linux kernel code
- Typically a monolithic program that is tightly linked to specific machine dependent code
- Owns all of the processor resources (memory, I/O, interrupts, etc?)
Interrupt Abstraction
The "Interrupt Abstraction" approach distinguishes between those processes that are real-time and other Linux processes which are considered non-real-time. This is achieved by a dual kernel approach, where a real-time operating system (RTOS) is given control over all of the system resources. The RTOS runs all real-time tasks as higher priority tasks and the Linux OS is implemented as a single lower priority task in the RTOS space. This approach guarantees predictable interrupt response times by preventing the Linux kernel from disabling hardware interrupts.
The "Interrupt Abstraction" paradigm requires the use of new RTOS APIs to communicate between the RT and the non-RT processes. Some industry experts might consider these new APIs to be proprietary and or non-standard Linux, thus not conforming to the true "spirit" of Linux.
Bell Laboratories first introduced this layered OS approach as MERT (Multi-Environment Real-Time Operating System) in 1975. In 1997, FSM Labs introduced and patented another known variation of this approach, summarized by the following FSM Labs patent abstract:
"A general purpose computer operating system is run using a real time operating system. A real time operating system is provided for running real time tasks. A general-purpose operating system is provided as one of the real time tasks. The general purpose operating system is preempted as needed for the real time tasks and is prevented from blocking preemption of the non-real time tasks."
 Figure 3: The Interrupt Abstraction Approach
Key points of the "Interrupt Abstraction" approach:- Major implementations: RTLinux, RTAI
- Distinction between real-time and non-real-time tasks (non symmetric)
- Interrupt handling removed from Linux control
- Real-Time tasks run in RTOS space, not Linux space
- Involves a Dual-Kernel approach
- System resources are under RTOS (non-Linux) control
Conclusions
In the past, using Linux in Embedded applications required an innovative approach to real-time processing due to the multi-user roots of the original kernel. Recent approaches such as "Preemption Improvement" and "Interrupt Abstraction" provided partial answers appropriate to a specific class of applications. MediaLinux's "Symmetrical Hosting" approach is different in that it is able to offer main-line kernel compatibility while maintaining real time characteristics. Developers of embedded applications can take advantage of the standard Linux programming environment while benefiting from the real-time characteristics of a Linux-controlled real time framework provided by the DSP infrastructure.
About the Authors: -- Eatamar Drory is CTO of Softier, Inc. Or Sagi is senior programmer at Softier. Additional information about Softier is available on Softier's website.
Related Stories:
(Click here for further information)
|
|
|
FUEL Database on MontaVista Linux
Whether building a mobile handset, a car navigation system, a package tracking device, or a home entertainment console, developers need capable software systems, including an operating system, development tools, and supporting libraries, to gain maximum benefit from their hardware platform and to meet aggressive time-to-market goals.
Breaking New Ground: The Evolution of Linux Clustering
With a platform comprising a complete Linux distribution, enhanced for clustering, and tailored for HPC, Penguin Computing¿s Scyld Software provides the building blocks for organizations from enterprises to workgroups to deploy, manage, and maintain Linux clusters, regardless of their size.
Data Monitoring with NightStar LX
Unlike ordinary debuggers, NightStar LX doesn¿t leave you stranded in the dark. It¿s more than just a debugger, it¿s a whole suite of integrated diagnostic tools designed for time-critical Linux applications to reduce test time, increase productivity and lower costs. You can debug, monitor, analyze and tune with minimal intrusion, so you see real execution behavior. And that¿s positively illuminating.
Virtualizing Service Provider Networks with Vyatta
This paper highlights Vyatta's unique ability to virtualize networking functions using Vyatta's secure routing software in service provider environments.
High Availability Messaging Solution Using AXIGEN, Heartbeat and DRBD
This white paper discusses a high-availability messaging solution relying on the AXIGEN Mail Server, Heartbeat and DRBD. Solution architecture and implementation, as well as benefits of using AXIGEN for this setup are all presented in detail.
Understanding the Financial Benefits of Open Source
Will open source pay off? Open source is becoming standard within enterprises, often because of cost savings. Find out how much of a financial impact it can have on your organization. Get this methodology and calculator now, compliments of JBoss.
Embedded Hardware and OS Technology Empower PC-Based Platforms
The modern embedded computer is the jack of all trades appearing in many forms.
Data Management for Real-Time Distributed Systems
This paper provides an overview of the network-centric computing model, data distribution services, and distributed data management. It then describes how the SkyBoard integration and synchronization service, coupled with an implementation of the OMG¿s Data Distribution Service (DDS) standard, can be used to create an efficient data distribution, storage, and retrieval system.
7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.
|
|
|
|
|