What is the purpose of the nice value in Linux process management? How can you view and adjust the nice value of a process using the `ps`, `nice`, and `renice` commands?
The nice value helps determine the priority of a process, by default the nice value of a program is 0. The higher the nice value, the nicer the process is, and the higher priority it gets. Programs that run for longer periods have a lower priority. Programs, that pause for a while are higher priority and nicer programs. We can view the nice values of an active process by using ps -l or ps -f(for long output). The nice value of a program is set by using nice and can be adjusted using renice.
The nice value gives a hint to the kernel's scheduler. this is what we care about when trying to influence the kernel's decision. the kernel adds the nice value to the current priority to determine the next time slot for the process. when you set the nice value higher, you're being "nicer" to other processes because the kernel prioritizes them.
we can use ps -l to see the nice value , also we can use nice -n to to modify the nice value of the current process, we can use renice n p to adjust the niceness n for a process having process id p.