How to prioritize and deprioritize specific processes
You can influence process performance by using nice values. Nice values assign a priority to cpu resources for process
Nice values range from -20 to 19
-20 | highest priority |
---|---|
0 | default priority |
19 | highest priority |
Normal users can set priorities from 0 to 19
the root can set priorities from -20 to 19
To change priorities look at lines labelled PR and NI to change a nice value press r
can also use the nice for new processes or renice for existing ones
example
renice -n -15 2155
the -15 is new nice value (need to be root to set it this low)
the 2155 is the process ID
to start a process with a particular priority use nice
nice -n nice_value command
you can check nice and CPU usage also with
ps -o pid,pcpu,nice,comm $(pgrep sha1sum)
note shaisum is the name of the process being checked here