Skip to content

ps priority('pri) different from value shown by top

Tested the following on CentOS 7(package procps-ng-3.3.10-16.el7.x86_64)

$ nice -n 3 top
   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 88307 sdiepend  23   3  157920   2432   1572 R   0.7  0.0   0:01.42 top
$ ps -eo pri,ni,cmd | grep ' top'
 16   3 top
 19   0 grep --color=auto  top

priority(PR) is calculated as 20 + NI in top(what I think is the correct way, should check in the kernel?)

Related earlier question: https://stackoverflow.com/questions/40546594/difference-in-ps-priority-vs-top-priority-output