我可以在我的流程中进行实时调度(但不影响其他流程)吗?
根据我的问题此处我想使用SCHED_RR
和 pthread_setschedparam
用于 Linux 应用程序中的线程。然而,这个甚至对我目前的内核模块也有影响无法解决。
我发现 http://www.icir.org/gregor/tools/pthread -scheduling.html 表示我可以使用 PTHREAD_SCOPE_PROCESS
属性创建线程,但我还没有找到有关此的更多信息。
这适用于 (Angstrom) Linux,内核版本 2.6.32 吗? (如何)这会影响我的流程与其他流程竞争的方式?这是让我的进程与实时调度竞争但其他进程不会受到影响的方法吗?
(因为我使用的是 boost 线程,所以我不能简单地尝试这个......)
According to my question here I would like to use SCHED_RR
with pthread_setschedparam
for my threads in a Linux application. However, this has effects even on kernel modules which I currently cannot solve.
I have found http://www.icir.org/gregor/tools/pthread-scheduling.html which says that I could create my threads with PTHREAD_SCOPE_PROCESS
attribute, but I haven't found further information on this.
Will this work with (Angstrom) Linux, kernel version2.6.32? (How) will this affect the way my process competes with other processes? Would it be the way to have my processes compete with real time scheduling but other processes would not be affected?
(As I am using boost threads I cannot simply try this...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
PTHREAD_SCOPE_PROCESS
创建的线程将共享相同的内核线程(http://lists.freebsd.org/pipermail/freebsd-threads /2006-August/003674.html )
但是,SCHED_RR 必须在 root 权限下运行 过程。
但是,根据您的链接问题,我认为您面临着更深层次的问题。您是否尝试过将内核设置得更加“抢占”?抢占应该允许内核强制安排停止运行您的进程,从而允许某些内核部分更快地运行。但这不应该影响 IRQ,也许有什么东西禁用了你的 IRQ?
我正在考虑的另一件事是,也许您获取 SPI 数据的速度不够快,并且内核中数据的缓冲区已满,因此数据丢失。也尝试增加这些缓冲区。
Threads created with
PTHREAD_SCOPE_PROCESS
will share the same kernel thread (http://lists.freebsd.org/pipermail/freebsd-threads/2006-August/003674.html )
However, SCHED_RR must be run under a root-privileged process.
However, basing on your linked problem I think you are facing a deeper issue. Have you tried setting your kernel to be more "preemptive"? Preemption should allow the kernel to forcibly schedule out of running your process allowing for more responsive running of some kernel parts. This shouldn't affect IRQs though, maybe something disabled your IRQs?
Another thing I am thinking about is maybe that you are not fetching your SPI data fast enough and the buffor for your data in the kernel becomes full and hence the data loss. Try increasing those buffers also.