我正在寻找我的Linux内核的时间片(或量子)的价值.
具体问题:
- 是否有
/proc
个文件公开了此类信息? - (或者)它在我的发行版的Linux标题中定义得好吗?
- (或者)Linux API的C函数(可能是sysinfo)是否公开了这个值?
我正在寻找我的Linux内核的时间片(或量子)的价值.
具体问题:
/proc
个文件公开了此类信息?分配给特定进程的量may vary:
你可以通过调整sched_latency_ns和sched_latency_ns来调整"切片"
这是因为默认的Linux调度程序Completely Fair Scheduler将assigns a proportion of the processor分配给进程,而不是固定的时间片.这意味着每个进程的时间片是proportional to the current load and weighted by the process' priority value.
对于使用SCHED_RR的特殊用途实时进程,默认时间片在Linux内核中定义为RR_TIMESLICE
:include/linux/sched/rt.h.
/*
* default timeslice is 100 msecs (used only for SCHED_RR tasks).
* Timeslices get refilled after they expire.
*/
#define RR_TIMESLICE (100 * HZ / 1000)
可以使用sched_rr_get_interval()
来获取特定SCHED_RR进程的SCHED_RR间隔.