Identifying the sources of non-determinism
Fundamentally, real-time programming is about making sure that the threads controlling the output in real-time are scheduled when needed and so can complete the job before the deadline. Anything that prevents this is a problem. Here are some problem areas:
- Scheduling: Real-time threads must be scheduled before others so they must have a real-time policy,
SCHED_FIFO
, orSCHED_RR
. Additionally they should have priorities assigned in descending order starting with the one with the shortest deadline, according to the theory of Rate Monotonic Analysis that I described in Chapter 10, Learning About Processes and Threads. - Scheduling latency: The kernel must be able to reschedule as soon as an event such as an interrupt or timer occurs, and not be subject to unbounded delays. Reducing scheduling latency is a key topic later on in this chapter.
- Priority inversion: This is a consequence of priority-based scheduling, which leads to unbounded delays when a high...