来自man renice:
超级用户以外的用户只能改变他们拥有的进程的优先级,并且只能在 0 到 PRIO_MAX (20) [...]
所以,我可以renice向上处理我自己的进程(给它们较低的优先级)但永远不会向下:
$ renice 10 22316
22316 (process ID) old priority 0, new priority 10
$ renice 9 22316
renice: failed to set priority for 22316 (process ID): Permission denied
Run Code Online (Sandbox Code Playgroud)
为什么是这样?我可以理解为什么普通用户不能将 nice 值设置为低于 0,但是为什么既然我可以将优先级降低到 10,我就不能再将它提高到 9?这有什么“安全原因”?我有权启动一个nice值为9的进程,那么为什么我不能将它重新设置为9呢?
编辑:我应该学会向下滚动。原来这被列为一个错误man renice:
BUGS
Non super-users can not increase scheduling priorities of their own
processes, even if they were the ones that decreased the priorities
in the first place.
Run Code Online (Sandbox Code Playgroud)
这更令人困惑。如果他们认为这种行为是一个错误,为什么不改变它呢?该 …