Friday, August 9, 2013

Anatomy of real-time Linux architecture

http://www.ibm.com/developerworks/library/l-real-time-linux/

An operating system that can support the desired deadlines of the real-time tasks (even under worst-case processing loads) is called a hard real-time system. But hard real-time support isn't necessary in all cases. If an operating system can support the deadlines on average, it's called a soft real-time system. Hard real-time systems are those in which missing a deadline can have a catastrophic result (such as deploying an airbag too late or allowing brake pressure to slip for too long). Soft real-time systems can miss deadlines without the overall system failing (such as losing a frame of video).
Although the thin kernel approach has its advantages (hard real-time support coexisting with a standard Linux kernel), the approach does have drawbacks. The real-time and non-real-time tasks are independent, which can make debugging more difficult. Also, non-real-time tasks do not have full Linux platform support (the thin kernel execution is called thin for a reason).
Examples of this approach include RTLinux (now proprietary and owned by Wind River Systems), Real-Time Application Interface (RTAI), and Xenomai.








The new configuration option CONFIG_PREEMPT changes this behavior of the kernel by allowing processes to be preempted if high-priority work is available to do (even if the process is in the middle of a system call).

Trade-off
Although the option enables soft real-time performance and even under load makes the operating system execute more smoothly,


it does so at a cost. That cost is slightly lower throughput and a small reduction in kernel performance because of the added overhead of the CONFIG_PREEMPT option. This option is useful for desktop and embedded systems, but it may not be right in all scenarios (for example, servers).

Kernel 2.6 for high resolution timers

1us resolution (if supported by underlying hardware)

Timer management (implemented with Red-black tree) for efficiency.

O(1) scheduler 

Preempt_RT Patch 

The PREEMPT_RT patch provides several modifications to yield hard real-time support. 

Reimplementing some of the kernel locking primitives to be fully preemptable,

Priority Inheritance

in kernel mutexes, and converting interrupt handlers into kernel threads so that they are fully preemptable

This article gave a brief overview of some of the techniques used to bring real-time computing to the Linux kernel. Numerous early attempts used a thin-kernel approach to segregate the real-time tasks from the standard kernel. Later, nano-kernel approaches came on the scene that appear very much like the hypervisors used in virtualization solutions today. Finally, the Linux kernel provides its own means for real time, both soft and hard.




No comments:

Post a Comment