HTOP nice level mismatch with the nice command?
12,070
The “nice” value ranges from -20 (top priority, not nice at all to other processes) to 19 (least priority, very nice to others). When you run nice -20
(equivalent to nice -n 20
) or sudo nice -n -42
(equivalent to sudo nice --42
) or any other value out of bounds, the nice value is moved to the bound.
The red is simply coloring applied to negative values in that column, indicating high-priority (“not nice”) processes. Positive values are green, indicating low-priority (“nice”) processes.
Related videos on Youtube
Author by
Dominique
Updated on September 18, 2022Comments
-
Dominique over 1 year
-
Dominique about 10 yearsNote that I executed a script with parallel and I also used
nice -20
on it, as well as commands in the script -
cristi over 8 yearswhat was the command you used to set niceness?
-
Cees Timmerman about 7 years
nice -20 vi
shows as green 20 in htop on MacOS Sierra.
-
-
Dominique about 10 yearsSo since I used
nice -20
it defaulted to least priority? -
Gilles 'SO- stop being evil' about 10 yearsYes,
nice -20
ornice -19
ornice -99999999
means the least priority which is 19. -
Dominique about 10 yearsSo I should use something like
nice +20
to get max priority? -
Rui F Ribeiro over 8 yearsOnly root can increase the priority of a process.
-
cristi over 8 yearsThis is not correct. nice -n -20 should set the niceness ro -20, not +19
-
Gilles 'SO- stop being evil' over 8 years@cristi I'm confused, what is not correct? Are you confusing
nice -20
andnice -n -20
?nice -20
is equivalent tonice -n 20
. Yes, it's a bit confusing to have the-
sign switch from being an option marker to a minus sign. -
Gilles 'SO- stop being evil' over 8 yearsThe question stated
nice -20
, which is the opposite ofnice -n 20
. -
cristi over 8 yearsSorry, I thought you said that niceness <-20 will go to 19
-
Cees Timmerman about 7 years@Gilles
-n
adjusts the Nice value by the amount following it, sonice -n 20
adds, just likenice -20
does (the-
denotes a parameter there, not a negative value). -
Cees Timmerman about 7 yearsA red value in
htop
means it's negative, so either the "red 19" was green (as indicated by the Unixnice
range), OP usednice -n -20
, or MacOS Sierra has differentnice
and/orhtop
behavior (-20 to 20 nice values is one).