How to change the priority of a Linux processFollow @ggarron
The Linux Kernel will take care of the time each process, will have to use the processor, but you can change that, by changing the priority.
When is this needed?, well usually never, but if you have a not to fast PC, and you are compiling something, and at the same time having a video conferencing, you may want to increase the priority of your video conference applications, while reducing the priority of the program compiling your software.
How to increase or decrease priority
We will use nice in order to change the priority of a given process, first you need to know the PID of the program you want to re-prioritize. You can use pstree or htop to discover the PID, if you use
pstree use it with the
Once you know the PID of the process you want to change its priority, use
renice to change it.
The permitted range is from “-20” to “20” being “-20” the highest priority.
As root run:
renice -8 -p 123
To assign a priority of -8 to a process with a PID of 123
Remember that only root can increase the priority, and normal users, can only alter the priority owned by them, and only to decrease its priority, and not to increase it.
Read the man page of renice: also keep in mind that you may need to change the priority of a parent process to affect all children processes. As an example, I usually have 5 to 6 firefox processes, all nested to a parent process, so, work with the parent. Use
pstree to find the parent.