3

I generate a normal process and check with cmd:

ps -p [PID] -o uname, cmd, cls, pri, rtprio

and have result

USER   CMD     CLS  PRI RTPRIO

haivo  ./pro1  TS   17    -

as far as I know Linux just know priority from 0 - 139 and priority from 0-99 for realtime process, but RTPRIO not show "rt" which means that my process just a normal process, another way pri = 17 belongs realtime priority range while my process just normal process. There seems to be a conflict.

red0ct
  • 4,840
  • 3
  • 17
  • 44
Hai
  • 73
  • 1
  • 10
  • 4
    Possible duplicate of [What is real time priority of a process](https://stackoverflow.com/questions/5732154/what-is-real-time-priority-of-a-process) – red0ct Dec 10 '18 at 14:17
  • maybe you misunderstood my mean, "pri" is 17 is bellow realtime range while "rtprio" is null that mean this is normal process, I thought "pri" should be from 100-139. Why it is 17? this is my question. – Hai Dec 11 '18 at 02:40
  • `haivo 4328 2197 ./pro1 TS 17 -`. Normal process still have pri = 17 while rtprio = null. – Hai Dec 12 '18 at 02:52
  • and I have mistake, priority from 0-139, not 0-140 – Hai Dec 12 '18 at 02:55
  • Upvote, because the question is reasonable. – red0ct Dec 12 '18 at 18:10

1 Answers1

4

You should focus on CLS-field of ps's output. From man ps:

CLS class of the process. (alias policy, cls).

- not reported

TS SCHED_OTHER

FF SCHED_FIFO

...

The ranges you talk about are from different scopes. The priority in SCHED_OTHER (SCHED_NORMAL) is often about the PR = 20 + NI formula, where NI is "nice" (between -20 and 19). But keep in mind - the formula is not always relevant, Linux kernel can change the priority on its own logic (but "nice" will remain the same, it's just a hint for kernel).

Thus, the value you see is absolutely correct.

See also: Very useful post about Linux nice and prio

Community
  • 1
  • 1
red0ct
  • 4,840
  • 3
  • 17
  • 44
  • I found the way to see nice value with right value regulated in document: `cat /proc/sched_debug` information in here really show what I want. Seem PRI in here and PRI in ps command is difference, I need time to find out – Hai Dec 13 '18 at 02:33