3.12. Real Time Throttling
The two real-time scheduling policies in Red Hat Enterprise Linux for Real Time share one main characteristic: they run until they are preempted by a higher priority thread or until they "wait", either by sleeping or performing I/O. In the case of
SCHED_RR, a thread may be preempted by the operating system so that another thread of equal
SCHED_RR priority may run. In any of these cases, no provision is made by the POSIX specifications that define the policies for allowing lower priority threads to get any CPU time.
SCHED_FIFOthread, it cannot perform the housekeeping tasks and eventually the entire system becomes unstable, potentially causing a crash.
SCHED_FIFOpriority (default: 50). A cpu-hog thread with a
SCHED_RRpolicy higher than the interrupt handler threads can prevent interrupt handlers from running and cause programs waiting for data signaled by those interrupts to be starved and fail.
Red Hat Enterprise Linux for Real Time comes with a safeguard mechanism that allows the system administrator to allocate bandwith for use by real-time tasks. This safeguard mechanism is known as
real-time scheduler throttling and is controlled by two parameters in the
/proc file system:
- Defines the period in μs (microseconds) to be considered as 100% of CPU bandwidth. The default value is 1,000,000 μs (1 second). Changes to the value of the period must be very well thought out as a period too long or too small are equally dangerous.
- The total bandwidth available to all real-time tasks. The default values is 950,000 μs (0.95 s) or, in other words, 95% of the CPU bandwidth. Setting the value to -1 means that real-time tasks may use up to 100% of CPU times. This is only adequate when the real-time tasks are well engineered and have no obvious caveats such as unbounded polling loops.
SCHED_OTHERand similar scheduling policies). It is important to note that if a single real-time task occupies that 95% CPU time slot, the remaining real-time tasks on that CPU will not run. The remaining 5% of CPU time is used only by non-realtime tasks.
RT_RUNTIME_GREEDwith the following command:
# echo RT_RUNTIME_GREED > /sys/kernel/debug/sched_features
# echo NO_RT_RUNTIME_SHARE > /sys/kernel/debug/sched_features
From the kernel documentation, which is available in the kernel-rt-doc package: