When to use renice
Use renice to change the CPU scheduling preference of an existing process. Verify the PID and current value first, and do not confuse scheduler preference with a guaranteed resource limit.
Syntax
renice -n PRIORITY -p PID…Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
View the priority of the current shell
ps -o pid,ni,cmd -p "$$"The shell's current niceness and identity are inspected without modification.
Run test task
sleep 120 &A temporary process starts in the background for a controlled example.
Decrease priority of last background job
renice -n 10 -p "$!"The most recently started background process is assigned a lower CPU scheduling preference.
Notes and limitations
- Use the $! example immediately after starting your own background job.
- The meaning of -n depends on the implementation and POSIXLY_CORRECT mode; check man renice. Raising priority requires privileges.
Common questions and troubleshooting
Why can I lower priority but not raise it again?
Ordinary users commonly can increase their own nice value but cannot freely decrease it. Policy and privilege control priority increases.
Will renice reduce disk or memory use?
It primarily changes CPU scheduling preference. Use the relevant resource controls or application settings for other bottlenecks.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man renice.