linux c/C++编程支持设置进程优先级吗?
问题描述:
在linux下,我可以使用“nice”命令设置进程优先级NP。但是我没有找到在我的c程序中设置这些信息的方法,我在[APUE]书中找不到线索。linux c/C++编程支持设置进程优先级吗?
是否有posix api来完成这项工作? 非常感谢。
答
unistd.h中有nice()函数。
实施例:
#include <unistd.h>
int main()
{
nice(4); // To set level 4 as nice value to current process
return 0;
}
http://www.tutorialspoint.com/unix_system_calls/nice.htm – Arunmu
如何关于['nice'](http://man7.org/linux/man-pages /man2/nice.2.html)系统调用? –