This page simply gives some hints for real time programming.
Scheduling with Real-Time
The scheduler is the kernel component that decides which runnable thread will be executed by the CPU next. Each thread has an associated scheduling policy and a static scheduling priority, sched_priority. The scheduler makes its decisions based on knowledge of the scheduling policy and static priority of all threads on the system.
Real-Time Policies:
• SCHED FIFO: static priority (1-99), can only lose the CPU to higher priority tasks or hardware interrupts
• SCHED RR: like SCHED FIFO but with round robin scheduling for tasks of the same priority
• SCHED DEADLINE: dynamic priority based on deadlines
Non-Real-Time Policies:
• SCHED OTHER: dynamic time slices based on nice value
• SCHED BATCH: a disfavored SCHED OTHER
• SCHED IDLE: run only when otherwise idle
CPU Affinity
CPU affinity enables binding a process or multiple processes to a specific CPU core in a way that the process(es) will run from that specific core only.
Each task has its own CPU affinity mask, specifying which CPUs it may be scheduled on.
• Boot parameters are available to set default masks for all tasks (including the kernel’s own tasks).
• A CPU affinity mask for routing individual hardware interrupt handling is also available