使用 PREEMPT_RT 构建 RT 应用程序 [英] Build an RT-application using PREEMPT_RT

查看:136
本文介绍了使用 PREEMPT_RT 构建 RT 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用实时 PREEMPT_RT 的同时编写实时 Linux 程序.我找到了官方维基(https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application).有一些代码示例,但我想得到可能的 RT 函数的解释.

I would like to write real-time Linux programs while using the real-time PREEMPT_RT. I found the official Wiki (https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application). There are some code examples but I would like to get the explanation of the possible RT-functions.

谢谢,

推荐答案

需要强调的是 PREEMPT_RT 是一个补丁,它改变了 Linux 内核的内部代码,以减少所经历的最大延迟用户级进程.这是通过改变例如自旋锁到实时可抢占互斥锁,使用线程中断(即,硬件中断处理程序在单独的内核线程中运行)等等.因此,它没有为用户级编程提供任何 API,您仍然依赖于标准的 libc 和系统调用原语.只需修补、配置并重新安装内核(或者,安装预构建的 PREEMPT_RT 内核).

It is important to underline that PREEMPT_RT is a patch that changes the internal code of the Linux kernel to reduce the maximum latency experienced by a user-level process. This is done by changing e.g. spinlocks to real-time preemptible mutexes, using threaded interrupts (i.e., hardware interrupts handlers run in seperate kernel threads) and so on. Therefore, it doesn't provide any API for user-level programming and you still rely on the standard libc and system call primitives. Just patch, configure and re-install the kernel (or, alternatively, install a pre-built PREEMPT_RT kernel).

当然,您仍然可以遵循实时编程的良好实践以避免延迟和争用.您提到的页面涉及如何配置内核和编写代码以充分利用补丁.

You can still, of course, follow good practice real-time programming to avoid delays and contentions. The page you are mentioning concerns how to configure the kernel and write your code to get full benefit from the patch.

如果您要寻找特定的实时 API,您可能需要查看 Xenomai 3.0.1提供特定的 API,用于在标准 Linux 或 Xenomai 管理程序(Linux 内核下方的一层)之上运行您的用户级进程

If you look for specific real-time APIs, you may want to have a look at Xenomai 3.0.1 which provides a specific API for running your user-level process on top of either the standard Linux or the Xenomai hypervisor (a layer below the Linux kernel)

这篇关于使用 PREEMPT_RT 构建 RT 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆