linux下默认的线程调度策略及优先级

linux下默认的线程调度策略:

linux下共有3种线程调度策略:SCHED_OTHER, SCHED_FIFO, SCHED_RR,打印出的值见下面:

SCHED_OTHER=0

SCHED_FIFO=1
SCHED_RR=2

经过测试,系统默认的调度策略是SCHED_OTHER。

每个策略的优先级返回见下

代码:

cout << "priority min=" << sched_get_priority_min(SCHED_OTHER ) << endl;
cout << "priority max=" << sched_get_priority_max(SCHED_OTHER ) << endl;
cout << "priority min=" << sched_get_priority_min(SCHED_RR) << endl;
cout << "priority max=" << sched_get_priority_max(SCHED_RR) << endl;
cout << "priority min=" << sched_get_priority_min(SCHED_FIFO) << endl;
cout << "priority max=" << sched_get_priority_max(SCHED_FIFO) << endl;

打印:

priority min=0
priority max=0
priority min=1
priority max=99
priority min=1
priority max=99

你可能感兴趣的:(linux下默认的线程调度策略及优先级)