Renice

From LQWiki
Jump to: navigation, search

renice is a command used to change the priority of running processes.

renice can be used to change the priority of a single process or a whole process group. It can also change priority for processes owned by a given user or group.

Note, however, that the nice value of a process is not the priority. a nice value of -5 means the process gets priority over processes with greater nice values, such as +5. The allowable nice values usually run from 20 to -20, with 0 being the default.

When renicing processes, permissions are taken into account. If you do not own the process, you cannot renice it. Also, even for processes you do own, it is still not possible to increase the priority beyond a system-specific level. (Usually 0) Both of these restrictions are ignored by the superuser.

Example renice commands: (Assumes apropriate permissions.)

#renice -2 -p 17055 

Sets the process with the PID of 17055 to a nice value of -2

#renice 10 -u user_name 

Sets all processes owned by user_name to a nice value of 10, decreasing the priority.

renice is also a system library call, which programmers can use to change the prority of a process.

See also