Linux – Should I set nice value lower for a user process to make it faster

linuxniceprocess

I recently learned about the nice value of a process. If I am running a user program, should I set the nice value as low as possible and would that make my process run faster?

Best Answer

Short answer

You can't (as a normal user), because it is a bad idea.

Long answer

Most of the time it will make no difference (if it is the only process running, or if the total number of threads running is less than number of cpu cores).

When it does make a difference the process will not be nice. It will hog your processor. The computer will start to become unresponsive.

Longer answer:

The only time when it makes sense to reduce nicenese is for real-time processes. That is for processes that need to get things done within a time-frame. These processes need to be written to be nice (not nice). That is to do there job and then give up the processor. You probably don't want to be fiddling with this. It is probably not needed as processes that behave nicely have their dynamic priority increased, anyway. (note there is also real-time priorities (see real time scheduler), that are even more extreme. You probably don't want to touch these ever. Especially on a production system. That is one that is doing something important. )

Related Question