如何更改 Linux 中特定线程 (LWT) 的优先级?

How to change priority of specific thread (LWT) in Linux?

可以这样查看一个进程的所有线程的优先级和调度策略:

ps H -o 'tid pri cls comm' PID

如何从命令行更改单个线程的优先级?

renicechrt这样的命令似乎影响了整个过程,但我正在搜索线程之间的关键路径。 /proc 中有什么有用的东西吗?

你可以使用 chrt

示例:

sudo chrt -r -p 40 1502

其中 40 是优先级,1502 是 TID

ps -eLo pid,tid,rtprio,ni,comm 输出的第二列