我可以在我的流程中进行实时调度(但不影响其他流程)吗?

发布于 2024-12-08 21:42:14 字数 720 浏览 0 评论 0原文

根据我的问题此处我想使用SCHED_RRpthread_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪花飘飘的天空 2024-12-15 21:42:14

使用 PTHREAD_SCOPE_PROCESS 创建的线程将共享相同的内核线程(
http://lists.freebsd.org/pipermail/freebsd-threads /2006-August/003674.html

但是,SCHED_RR 必须在 root 权限下运行 过程。

循环赛;争用范围为系统的线程
(PTHREAD_SCOPE_SYSTEM) 处于实时 (RT) 调度级别,如果
调用进程的有效用户 ID 为 0。这些线程,如果不是
被更高优先级的线程抢占,并且如果它们不产生或
块,将在系统确定的时间段内执行。
SCHED_RR 用于具有进程争用范围的线程
(PTHREAD_SCOPE_PROCESS) 或其调用进程没有
有效用户id为0是基于TS调度类。

但是,根据您的链接问题,我认为您面临着更深层次的问题。您是否尝试过将内核设置得更加“抢占”?抢占应该允许内核强制安排停止运行您的进程,从而允许某些内核部分更快地运行。但这不应该影响 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.

Round-Robin; threads whose contention scope is system
(PTHREAD_SCOPE_SYSTEM) are in real-time (RT) scheduling class if the
calling process has an effective user id of 0. These threads, if not
preempted by a higher priority thread, and if they do not yield or
block, will execute for a time period determined by the system.
SCHED_RR for threads that have a contention scope of process
(PTHREAD_SCOPE_PROCESS) or whose calling process does not have an
effective user id of 0 is based on the TS scheduling class.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文