Toolserver:Nice


 * Note: The information on this page applies to Linux servers. For Solaris (e.g. willow), see batch project.

nice tells the system how much CPU time to devote to that process when there is a competition for resources. This is useful in multiuser environments where there are limited resources. Long-running processes (like bots) should usually have a high niceness level (i.e. low priority) like 10. The default level is 0 (which is the highest priority available to non-privileged users). The highest nice level is 19. Your processes may be reniced forcefully if necessary.

If the CPU can deliver more resources than the process is requesting, then even the lowest-priority process can eat 100% CPU. It's only when multiple processes are vying for resources and CPU can't deliver as much as the processes are requesting that nice levels become relevant.

If you are running niced processes from cron, you should look at using batch job scheduling instead; this will handle setting the nice level for you.

Use with cron and/or phoenix
Recall that processes inherit the nice level of their parent. If using cron, one might try to do */5 * * * * /usr/local/bin/phoenix nice -n 10 python /home/user/program.py >/dev/null But that is wrong and your program will not work properly. Instead, set the nice level on phoenix and let the spawned process inherit it: */5 * * * * nice -n 10 /usr/local/bin/phoenix python /home/user/program.py >/dev/null This of course applies if you're not using cron: nice -n 10 phoenix python /home/user/program.py

renice
renice can be used to increase the nice level of already-running processes (you cannot reduce nice levels unless you're root): renice 10 -p 1234 If necessary, you can renice all processes belonging to you: renice 11 -u $USER

Viewing nice levels
You can view nice levels in the column "NI" with top -c -u $USER

Or: ps l Or if you have processes with no TTY, use ps xl