linux应用进程优先级配置

linux应用进程优先级配置



example:

#include <sched.h>

int set_process_priority(void)
{
	int pri;
	struct sched_param param;

	pri = sched_get_priority_min(SCHED_RR);
	if (pri == -1) {
		printf("sched_get_priority_max() failed\n");
		return -1;
	}
	param.sched_priority = pri;
	if (sched_setscheduler(getpid(), SCHED_RR, &param) == -1) {
		printf("sched_setscheduler() failed\n");
		return -1;
	}
	return 0;
}


posted @ 2023-08-08 10:18  王阳开  阅读(63)  评论(0编辑  收藏  举报