Reputation: 91
I've patched my Raspbian OS with the PREEMPT_RT patch to make my OS preemptable. How do I make one of my applications run real-time? (Loadable Kernel Modules, etc.)
Upvotes: 1
Views: 4394
Reputation: 93476
Processes in Linux are already preemptable through round-robing time-slicing. What the PREEMPT_RT patch does is support priority based preemption. That is the highest priority ready thread runs until it blocks or is preempted by a higher priority thread becoming ready. Without PREEMPT_RT higher priority threads simply get allocated more and/or larger time slices. (Somewhat simplistic description - Linux scheduling is a little more sophisticated that that in practice).
A process does not magically become "real-time" by being run on a real-time OS or even PREEMPT_RT. These simply provide real-time support - your application still has to be designed appropriately to meet real-time deadlines. From Real-time Linux Wiki FAQ:
A bad designed application on non-RT will never behave realtime on RT.
You can set the priority and scheduling policy of a existing process using chrt. But as explained, running a process at a high priority does not necessarily make it "real-time". The worst case will be that your process hogs the processor so that nothing else can run.
Upvotes: 3