In the top
and htop
tools, processes (or/and threads depending on display settings) having the highest realtime priority (99 from the userland API point of view) with either the scheduling policy SCHED_RR
or SCHED_FIFO
the priority is displayed as RT
.
For all the other real time processes, the priority is displayed as a number p defined by:
p = -userprio -1
I am wondering why top
and htop
don't display -100
for higest priority real time processes ?
Best Answer
That's because
SCHED_RR
andSCHED_FIFO
have fixed static priorities in the range 1-99: RedHat MRG docs on rtFor realtime priorities, the order is reversed: 99 is indeed the highest one, contrary to the usual "lower is higher".
Per your comment I misunderstood your question, sorry.
There is only one column in top, so differentiating the RT priorities from the other ones would not be possible. To get around this, "rt" is used to indicate that these processes use a realtime scheduler class.
You can see the difference using
ps ax --format uname,pid,ppid,tty,cmd,cls,pri,rtprio
, which will give you 2 columns, one for the prio and the other one for rtprio.Sidenote: The aforementioned command will also show you the scheduler class the process uses (the
cls
field).