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, ¶m) == -1) {
printf("sched_setscheduler() failed\n");
return -1;
}
return 0;
}