Saturday, April 24, 2010

LINUX: Process information--priority and niceness

When doing Linux system administration, it can often become necessary to see what the "niceness" or priority of a certain process is. The concept of a process being "nice" has to do how it hogs system resources. We're not going to discuss the details of what priority and nice are here, hopefully if you are reading this you already know. The point though is that you can use the below command, especially the forest hierarchy, to debug problems. Just typing in "ps" doesn't give you this information natively, so you have to pass it a few options to get it. And when looking at the hierarchy, you can determine if a parent process has low priority or a high nice value. For example, if you look at the details for a GCC build and see that it is running with normal values, but it is taking way to long, looking at the forest hierarchy may reveal that the bash shell it is spawned under is running with low priority and high nice value, which will affect the overall performance.

To get process information showing priority and niceness:
ps -o pid,ni,pri,comm f -U <username>

-U specifies user. The "f" shows a ASCII art forest hierarchy.

No comments:

Post a Comment