gpt4 book ai didi

linux - 如何查看 `ps` 输出以外的进程调度策略

转载 作者:IT王子 更新时间:2023-10-29 00:35:30 26 4
gpt4 key购买 nike

我正在使用 busybox 版本的 linux 并想检查进程调度策略。 PS 输出仅显示 PID USER VSZ STAT COMMAND,而不考虑 PS 命令给出的任何选项。有没有其他方法可以查看进程调度策略?

提前致谢!

最佳答案

您可以通过查看/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.

关于linux - 如何查看 `ps` 输出以外的进程调度策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23487699/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com