Knowing a nice person is good, being nice, even better but in the computer world, there is this funky concept of “nice” which determines the scheduling priority of a process.
The scope here is that you are doing some programming and you want to be able to control or set the priority. You can set the nice value to anywhere between -20 and 20. The higher the nice value, the lower the priority.
Say what? Do you mean a nice of 20 has the lowest priority? Yep. To help understand why, this excerpt explains it well:
The idea of the nice value is deferential courtesy. In the beginning, in the Unix garden of Eden, all processes shared equally in the bounty of the computer system. But not all processes really need the same share of CPU time, so the nice value gave a courteous process the ability to refuse its equal share of CPU time that others might prosper. Hence, the higher a process’ nice value, the nicer the process is. (Then a snake came along and offered some process a negative nice value and the system became the crass resource allocation system we know today).
Source: http://www.gnu.org/software/libc/manual/html_node/Traditional-Scheduling-Intro.html
Now nice is linked to getpriority and setpriority and to get your hands dirty with some real experience (it’s the only way to learn), check out this link with real code snippets. http://u.cs.biu.ac.il/~linraz/os/OS5.pdf
I’ve included a link to the file here in case that link gets broken.