2

Why does unix ps -l whows one number in column "PRI" but in same time ps -o pri shows another number?

P.S. cpu and nice are zero for those processes

1 Answer 1

7

In linux procps, the column labeled "PRI" in ps -l is -o opri. Examining output.c shows half a dozen different priority output types:

// "priority"         (was -20..20, now -100..39)
// "intpri" and "opri" (was 39..79, now  -40..99)
// "pri_foo"   --  match up w/ nice values of sleeping processes (-120..19)
// "pri_bar"   --  makes RT pri show as negative       (-99..40)
// "pri_baz"   --  the kernel's ->prio value, as of Linux 2.6.8     (1..140)
// "pri"               (was 20..60, now    0..139)
// "pri_api"   --  match up w/ RT API    (-40..99)

Show all of them with:

ps -o pid,priority,opri,pri_foo,pri_bar,pri_baz,pri,pri_api,comm

  PID PRI PRI FOO BAR BAZ PRI API COMMAND
 2201  20  80   0  21 120  19 -21 zsh
 2762  30  90  10  31 130   9 -31 cat
 2826  20  80   0  21 120  19 -21 ps

(cat is nice cat /dev/zero > /dev/null)

The -o pri value is not suitable for the UNIX standard's "PRI" column, since higher numbers must mean lower priority, so it is not used. I believe these two columns are copied from solaris. The -o pri column is used internally for the "PRI" column of ps -lc.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.