Hard real time in user space with preempt_rt patch

1.9k views Asked by At

From: https://rt.wiki.kernel.org/articles/f/r/e/Frequently_Asked_Questions_7407.html

Real-time only has impact on the kernel; Userspace does not notice the difference except for better real time behavior.

Does it mean that if we write the applications in user space, they won't get the hard real time effect?

4

There are 4 answers

1
Matthias On BEST ANSWER

It depends what you mean with "real-time effect". Usually you want a guaranteed timing behavior in a real-time system. You won't get that. However, your application will run more "smoothly" and will be more responsive. For many best-effort systems, that will be sufficient.

0
sarnold On

I believe that question can be best answered in context -- asking if there were any APIs introduced by that specific patchset that application authors can use -- and none are added by this patchset. You won't need to recompile your application and there is no benefit to recompiling. You also won't be locked into any specific API.

If you have a well-written userspace application that relies on being able to run as soon as possible when hardware conditions dictate it should respond, then yes, these patches can help. But you can still write poor applications that prevent good real-time behavior and the patchset cannot help you.

0
Claudio On

No, that's not what it meant.

It means that with PREEMPT_RT you get lower maximum latency in user-space without the need of adapting your code or using additional libraries/tools. In practice: PREEMPT_RT doesn't need user-level applications to use specific APIs.

The APIs within the kernel code, instead, are significantly changed (e.g., by changing any spinlock to a mutex, etc.)

By the way, keep in mind that PREEMPT_RT reduces the maximum latency experienced by a task, but the system throughput will be lower (i.e., more context switches) and the average latency likely increased.

0
Ehsan Mirsaeedi On

It means that Real-Time Patch will manipulate some codes in kernel and the effect of this manipulation is that we will have a fine grained preemptive kernel. All programs in user space will benefit from real-time preemptive kernel, without any modification. even no recompile is needed! PREEMPT_RT patch goal is to convert Linux to a Hard Real Time System and it`s really good for most of the tasks. but in safety critical systems such as military and aerospace, Linux has nothing to offer and we should use other RTOSes like VxWorks, QNX and Integirty!