Here is the video version, if you prefer it:
Let’s talk about process priorities today. Why do processes even have priorities?
Let’s say that the world within your computer is like the real world. Let’s further imagine you are going about your day, doing your thing, driving your car, when all of a sudden you hear an ambulance. Uh-oh. You know you have to move yourself out of the ambulance’s way, because it has priority.
By the same token, processes in your operating system have priorities, depending on how important they are. In Linux, processes have priorities which range from -20 to 20, with -20 being the most important. Yes, you read that right: -20 is the highest priority. (Ward, 2014)
There is also something called a nice value, which is added to the process priority. By default, it is 0. This makes sense – as we learned in the previous paragraph, the higher the priority (in terms of its number), the lower it actually is. So if a processes nice factor is 10, then its real priority is whatever priority it has + 10. The higher the nice value, the more nice the process, since it effectively lowers its own priority. You will most likely never have to meddle with the nice level of a process.
Hope you learned something useful!
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 179-180
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.