On 06/13/2009 05:09 PM, Vu Pham wrote:
Using top and ps, reports of schedule priority of tasks are different.
For example, under my two servers RHEL5.3, init has PRI of 24 under ps,
and 15 under top, events/0 has PRI of 29 under ps, and 10 under top.

Anybody experiences this problem ?

(Both servers have the lastest kernel 2.6.18-128.1.10, one 32 bits and
one 64 bits )


I asked for help from RHN for the above question and found the answer interesting. I hope you find same thing.


---------------------------------------
|  Case Information  |
---------------------------------------
Case Title : [SEG]: conflict in report of scheduling priority of proceccess
Case Number      : 1927400
Case Open Date   : 13-JUN-2009
Problem Type     :
Last Update Comment as of 24-JUN-2009 02:32:03   :
Dear Sir,

There is some discrepancy in ps output caused by the fact that each system may use different values to represent the process priority and that the values have changed with the introduction of RT priorities.

The kernel stores the priority value in /proc/<pid>/stat (let's call it p->prio) and ps reads the value and displays it in various ways to the user:

$ ps -A -o pri,opri,intpri,priority,pri_foo,pri_bar,pri_baz,pri_api,pid,comm
PRI PRI PRI PRI FOO BAR BAZ API   PID COMMAND
 19  80  80  20   0  21 120 -21     1 init
 24  75  75  15  -5  16 115 -16     2 kthreadd
139 -40 -40 -100 -120 -99 0  99     3 migration/0
 24  75  75  15  -5  16 115 -16     4 ksoftirqd/0
139 -40 -40 -100 -120 -99 0  99     5 watchdog/0
139 -40 -40 -100 -120 -99 0  99     6 migration/1
 24  75  75  15  -5  16 115 -16     7 ksoftirqd/1
139 -40 -40 -100 -120 -99 0  99     8 watchdog/1
 24  75  75  15  -5  16 115 -16     9 events/0

Yes, there are 8 undocumented values for the process priority that can be passed to -o option:

Option     Computed as

prioirity  p->prio
intpri     60 + p->prio
opri       60 + p->prio
pri_foo    p->prio - 20
pri_bar    p->prio + 1
pri_baz    p->prio + 100
pri        39 - p->priority
pri_api    -1 - p->priority

They were introduced to fit the values in certain intervals and compatibility with POSIX and other systems.

The top utility shows the same value as ps with "-o priority", whereas ps with -l option shows the same value as with "-o intpri" (or "-o opri") and if both the -l and -c options were used, ps uses the value as with "-o pri".

Please let me know whether this answers the question.

Regards.
Nitin

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to