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.
This approach adds a module to a kernel to provide reservations for various types of resources. The reservations guarantee access to time-multiplexed system resources (CPU, network, or disk bandwidth).
Using a scheduling algorithm such as Earliest-Deadline-First (EDF), the kernel can then be used to handle the dynamic scheduling workload.
Today, in the 2.6 kernel, you can get soft real-time performance through a simple kernel configuration to make the kernel fully preemptable (see Figure 6). In the standard 2.6 Linux kernel, when a user space process makes a call into the kernel (through a system call), it cannot be preempted.
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