简体   繁体   English

使用preempt_rt补丁在用户空间中实时很难实现

[英]Hard real time in user space with preempt_rt patch

From: https://rt.wiki.kernel.org/articles/f/r/e/Frequently_Asked_Questions_7407.html 来自: 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? 这是否意味着如果我们在用户空间中编写应用程序,它们将无法获得实时的硬实时效果?

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. 这意味着使用PREEMPT_RT可以在用户空间中获得更低的最大延迟,而无需调整代码或使用其他库/工具。 In practice: PREEMPT_RT doesn't need user-level applications to use specific APIs. 实际上:PREEMPT_RT不需要用户级应用程序来使用特定的API。

The APIs within the kernel code, instead, are significantly changed (eg, by changing any spinlock to a mutex, etc.) 相反,内核代码中的API会发生显着变化(例如,通过将任何自旋锁更改为互斥锁等)

By the way, keep in mind that PREEMPT_RT reduces the maximum latency experienced by a task, but the system throughput will be lower (ie, more context switches) and the average latency likely increased. 顺便提一下,请记住,PREEMPT_RT会减少任务所经历的最大延迟,但系统吞吐量会降低(即更多上下文切换),平均延迟可能会增加。

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. 对于许多尽力而为的系统来说,这就足够了。

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. 我相信这个问题可以在上下文中得到最好的回答 - 询问应用程序作者可以使用的特定补丁集是否引入了任何API - 并且此补丁集都没有添加任何API。 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. 您也不会被锁定在任何特定的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. 但是你仍然可以编写糟糕的应用程序来阻止良好的实时行为,而补丁集也无法帮助你。

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. 这意味着Real-Time Patch将操纵内核中的一些代码,这种操作的效果是我们将拥有一个细粒度的抢占内核。 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. PREEMPT_RT补丁目标是将Linux转换为硬实时系统,它对大多数任务都非常有用。 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! 但是在军事和航空航天等安全关键系统中,Linux没有什么可提供的,我们应该使用其他RTOS,如VxWorks,QNX和Integirty!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM