我正在使用linux的busybox版本,并且想要检查进程调度策略。 PS输出只显示PID USER VSZ STAT COMMAND ,与PS命令给出的任何选项PID USER VSZ STAT COMMAND 。 有没有其他方法来检查进程调度策略?
提前致谢!!
您可以通过查看/proc/pocess_id/sched来查找进程的计划信息。
例如:
awk '/policy/ {print $NF}' /proc/25/sched
会给你过程25的保单号码。
有关策略编号的更多信息,可以查看man sched_setscheduler :
Scheduling Policies: ... For threads scheduled under one of the normal scheduling policies (SCHED_OTHER, SCHED_IDLE, SCHED_BATCH), sched_priority is not used in scheduling decisions (it must be specified as 0). Processes scheduled under one of the real-time policies (SCHED_FIFO, SCHED_RR) have a sched_priority value in the range 1 (low) to 99 (high). (As the numbers imply, real-time threads always have higher priority than normal threads.) Note well: POSIX.1-2001 requires an implementation to support only a minimum 32 distinct priority levels for the real-time policies, and some systems supply just this minimum. Portable programs should use sched_get_priority_min(2) and sched_get_priority_max(2) to find the range of priorities supported for a particular policy.
要知道您的内核已经配置了哪个IO调度程序类型:
cat /proc/config.gz |grep CONFIG_DEFAULT_IOSCHED