- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试将线程的调度策略设置为 SCHED_RR 时,我收到未知错误代码(实际上是 48)。
这是我的代码示例:
#include <sched.h>
#include <pthread.h>
#include <stdio.h>
int main() {
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
int ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
printf("ret: %s\n", strerror(ret));
return 0;
}
追踪:
ret: Unknown error
为什么会这样呢?这不像我在其他问题中看到的那样是 EPERM。
我在 Windows 7 上使用 cygwin。
最佳答案
如果您阅读了 cygwin 中 pthread 的文档:
https://sourceware.org/pthreads-win32/announcement.html
您可以看到仅支持 SCHED_OTHER
:
pthread_attr_setschedpolicy (only supports SCHED_OTHER)
关于c - 将线程策略设置为 SCHED_RR 时出现未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48881602/
尝试将线程的调度策略设置为 SCHED_RR 时,我收到未知错误代码(实际上是 48)。 这是我的代码示例: #include #include #include int main() {
根据我在搜索过程中了解到的情况,FIFO 任务需要阻塞或自愿放弃,以便释放 CPU 并允许其他任务在该 CPU 上运行。我不能确定的是 3 个具体情况: 1) 优先级为 99 的(可运行的)FIFO
我们正在使用pthread API开发多媒体跨平台应用程序。我们希望提高音频线程的优先级,使其即使在 CPU 较高的情况下也能正常工作。有些事情不容易通过测试来观察,所以我想先了解它是如何工作的。 我
我有一个嵌入式 Linux 平台(Beagleboard,运行 Angstrom Linux),连接了两个设备: 通过 USB 连接的激光测距仪 (Hokuyo UTM 30) 通过 SPI 连接的自
我想用 RR 调度创建 3 个线程。在每个线程中我将创建例如5 个线程,采用 FIFO 调度。 我知道3个线程有指定的处理时间。在此期间,其他 5 个线程应以“RR”调度运行。在这段时间之后,其他 2
我们有一个使用内核 3.14.17、PREEMPT RT 的 Linux 系统。它是一个单核系统。 对于延迟问题,我们的应用程序将其某些线程的调度类型设置为 SCHED_RR。但是,这会导致内核中的
SCHED_FIFO 和 SCHED_RR 都是为实时使用而设计的。我知道 SCHED_RR 可以被时间片抢占。但是如果我有一个线程设置为 SCHED_FIFO,另一个设置为 SCHED_RR,如果两
我的框中的以下值: sysctl -A | grep "sched" | grep -v "domain" kernel.sched_autogroup_enabled = 0 kernel.sche
我在 Linux 下有一个进程,由两个线程组成,一个生产者和一个消费者。为简单起见,假设这是在单核、单 CPU 架构上的系统中运行的唯一进程。 生产者首先被创建,并使用 sched_setschedu
我正在 Linux 中做一些时间计算测试。我的内核是 Preempt-RT(但是 vanilla 内核在我的测试中给出了类似的结果......) 我有两个 pthread,在同一个处理器中同时运行(给
如何获得以初始优先级创建的 pthread 线程?在下面的代码中,我声明了执行此操作所必需的上限,事实上,它确实将线程的优先级更改为 15,但由于某种原因线程总是以优先级 0 开始,即使我指定它需要
谁能解释一下 SCHED_OTHER、SCHED_FIFO 和 SCHED_RR 之间的区别? 谢谢 最佳答案 SCHED_FIFO 和 SCHED_RR 是所谓的“实时”策略。它们实现了 POSIX
我有以下代码片段: #include #include #include #include #include int main() { std::thread rr_thread([
我正在 Raspberry Pi 上运行一个 python 程序,我想将其设置为 SCHED_FIFO 或 SCHED_RR 优先级。我在网上找到了一些使用 C/C++ 执行此操作的人的信息,代码如下
我正在试验 SCHED_FIFO,我看到了一些意外行为。我使用的服务器有 12 个内核,禁用了超线程。所有可配置的中断都已设置为在 CPU 0 上运行。 我的程序开始使用 pthreads 库为较低优
我正在编写一个非常小的守护进程,即使在系统承受巨大压力时它也必须保持响应。我正在研究 SCHED_FIFO 和 SCHED_RR 在调度方面的差异,并试图确定一个合理的优先级。 哪种调度程序适合小型但
想知道这里是否有消息灵通的 Linux 专家可以回答我的问题。我一直在为我的 OS 类做统计分析,其中调度程序对 CPU 和 IO 绑定(bind)进程更有效/有效。我无法解释从 GNU 时间得到的一
我是一名优秀的程序员,十分优秀!