Monday, January 19, 2009

Being Nice

The subject of the post is a bit misleading. This is not a morality lesson rather yet another technical post. However it is about Linux rather Oracle, so you can say change factor is there.

Process scheduling is among the most important tasks that a kernel must do in order to effectively achieve Multiprogramming. Multiprogramming is a concept that all modern operating systems implement; it allows the user of the system to run several applications at a time. However in reality there can be only one application or process that can use the CPU at any given time. The kernel of the operating system switches the CPU from one process to the other and it does so extremely quickly that the user gets the illusion that multiple processes are using the CPU at a time. The decision that which process to run at what time is very critical and kernel does this by scheduling processes. Different operating systems use different algorithms. One of the things upon which the kernel relies on in making the decision of which process to run at any given time is; Process Priority.

Process priority is a value that is given to each process which determines how much this process is important. Linux handles the process priority by setting a nice value to every process. It's a nice analogy and it means that how much a process is nice to the others. A higher nice value means lower priority (process is nice to the others) and vice versa. The administrator can set the nice value and can also change it at any time. Most Linux distributions include priority classes for more complex process scheduling but they are rarely used instead the Nice value is more common and much reliable.