1

The ps command shows the state of the process (e.g. Sleeping, Running etc) as also some additional info about.

Among two of these additional options according to the man page are

< high-priority (not nice to other users)

N low-priority (nice to other users)

When playing around with sudo htop I realized the niceness value can be set to [-20, 19].

What is the threshold that distinguish a nice from a not nice process?

  • 3
    Any niceness value less than zero is "not nice", any above zero is "nice". A proper answer would probably mention the restrictions on setting negative niceness values and the person answering should probably be more familiar with Linux than I am (I assume this is on a Linux system, and I only use these occasionally). – Kusalananda Nov 12 '18 at 19:42
1

As Kusalananda said, any value less than zero is not nice to other users, and any value greater than zero is nice to other users. I couldn’t find documentation which is explicit about this, but you can see it in the procps source code:

if(pp->nice < 0)                  outbuf[end++] = '<';
if(pp->nice > 0)                  outbuf[end++] = 'N';

If you’re particularly interested in Linux, see man 7 sched for extensive detail on its scheduling policies. Unfriendly nice levels can traditionally only be set by root, but unprivileged processes can be allowed to do so on Linux by raising the RLIMIT_NICE resource limit.

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.