【发布时间】:2014-04-15 17:39:37
【问题描述】:
int pri = getpriority(PRIO_PROCESS, 2134);
printf("The original priority of 2134 is :%d", pri);
//cpu_usage of the process in top is 80%, pri is 39 and NICE value is 19
setpriority(PRIO_PROCESS, 20);
int p = getpriority(PRIO_PROCESS, 2134);
printf("priority is set to :%d", p);
在这里,我正在尝试为进程设置优先级(pid:2134)。在 top 命令中显示优先级为 39,nice 值为 19。因此进程的优先级非常低。但是该进程的 CPU 使用率高于 70。如果我将优先级设置为最小值,则该进程的 CPU 使用率应该会降低。我很困惑是否将优先级设置在 40..1 或 -19..20 的范围内。任何人都可以检查一下。任何帮助将非常感激。
【问题讨论】: