Mapusoft Technologies is the leading provider of porting and abstraction solutions that increase the
level of code re-use to protect software investment.
Copyright © 2011 MapuSoft Techologies, Inc. All rights reserved.
Optimizing Linux for Better Real-time Performance
Many embedded developers use Linux in their projects. In fact, our last article highlighted the Advantages of Moving to Linux
However, some developers are feeling additional pressure to get a performance increase from their embedded Linux operating system. To achieve this additional performance means that they will need to dig into the Linux operating system code, which could be disastrous.
MapuSoft’s Linux OK (Linux Optimization Kit) provided by the OS Abstractor framework provides several options for Linux users to achieve higher performance. In other words, MapuSoft’s OS Abstractor can enhance Linux without making major changes to the kernel.
Here are some of the features that Linux OK provides for optimizing Linux:
Real-time Features: User applications in Linux OK have reliability as the applications are launched as a separate thread in user space. Applications can be broken into smaller modules (or processes). The resources within a process can be freely accessed by other processes, provided they are created with system scope. This allows a process to easily use resources from others using the same API mechanism as if the resource actually belongs to itself. Real-time features are provided in the user space. Processes are identified by the operating system as programs that execute in memory or on the hard drive. They are assigned a process ID or a numerical identifier so that Cross-OS may keep track of the programs currently executing and of their associated priority levels. Such an approach ensures a higher reliability (predictability) than Linux is capable of providing on its own.
Mission Critical Features: Applications have the ability to recover from software fatal errors through a soft reset by rolling the stack back to the start of the application.
Enhanced Performance: Linux OK provides several options for Linux users to achieve higher performance. Linux OK, in addition to providing an abstraction through the OS Abstractor framework, was built to provide additional performance for embedded applications. For Linux, this means you don’t need to keep and maintain multiple ‘variants’ of your application in order to keep track of the changes in the POSIX API. Linux OK allows you to easily incorporate those new APIs into your application, which eliminates having multiple copies of your application code around.
Better POSIX Coverage: Use of MapuSoft’s POSIX Interface enhances the Linux POSIX capability which is not a 100% POSIX compliant on its own.
Memory Management: The Linux OK Memory Allocation framework eliminates dynamic memory allocation by pre-allocating memory during the operating system initialization. It also ensures that the application will not use more memory than the allocated amount to prevent the system from running out of memory and impacting other applications. The Linux OK design minimizes the occurrences of task switching and user/kernel mode switching to improve your application's run-time performance.
The Linux OK framework offers Tiered Memory Pools. When the user requests a segment of memory, a partition is pulled from the best matching pool, based on the block size that was requested.
Linux OK also offers Shared Memory Pools. Providing a memory pool in shared memory is a major issue, especially in operating systems that use virtual memory. The problem is that when the pool is mapped into another process, there is no guarantee that the memory addresses will match. This means that the linked list nodes can't be used directly as with the local pools. Instead, the partitions will be accessed array style. When a partition is allocated, a combination of the array index, pool ID and the tier the partition came from will be returned as an ID.
Application Optimization: There are also multiple optimization switches that are available for increased performance, including eliminating the need to switch between kernel and user mode, adding mission critical features and limiting memory allocation settings.
Scalability Specific to Your Application: Linux OK also provides API optimization, which is a way to get additional performance by optimizing the most used functions in your application. Additional optimization is also achieved through the Profiling feature. Profiling can be done to accurately pinpoint the areas of the application that are performing poorly and adjust them.
API Flexibility: Use same OS Abstractor/OS Changer Interface APIs within and across processes, combine applications written with different OS APIs and run on one or many operating systems (e.g. VxWorks & Linux). Linux OK also allows you to use native API’s in your applications if necessary. The library is designed to be fully portable with other commercial or proprietary operating systems. It is independent of target hardware and development tools.
Clear Separation of Hardware/Software Layers: With Linux OK, changes can be made to the low-level code without impacting the application. Unfortunately most software designs don’t provide this separation, which protects the original application code.
Reduced Learning curve: One of the most under-estimated tasks in a software project is the ramp-up time developers must go through to become productive on a new operating system. The cost of learning a new operating system is significant. Linux OK offers an easy-to-learn interface that can be re-used across projects, reducing your team’s learning curve and increasing their productivity.