HOWTO: Monitor Processes
Programs that are executing are called tasks or processes. While most processes simply come to life when launched, do their assigned task and teminate, sometimes a process will refuse to terminate or run wild.
In a Windows system you’re stuck with the old control-alt-delete and selecting the Task Manager. I don’t know about you, but whenever I’ve killed a Windows application in the Task Manager, it’s a 50/50 proposition whether it will actually kill the task, or take my whole system down instead. Not so in Linux. When I kill a task on my Linux box it’s just gone. Blammo!
Killing a wild process is only one of the things that you may want to do to a process. There are three main command line tools used to manage processes in Linux: ps, pstree, and top. I’ll be looking at each of these three commands over the next three days, but first we need to know some of the basic information that a process has. Each process has (or may have) a lifetime, a process ID (PID), a user ID (UID) or Group ID (GID), a parent process, and a parent process ID (parent PID), an environment, and a current working directory.
Process ID
Each process has a unique numerical process ID assigned to it. This is a system-wide unique number which makes it easy to positively identify a specific process.
User ID or Group ID
Each process must have a UID or GID associated with it to control its access to the file system.
Parent Process (and parent Process PID)
Each process has a parent PID which is the process that started it. At the top of the parent process tree is the init process.
Environment
The environment that a process is running in includes things like environment variables.
Current Working Directory
The current working directory of a process is…well…you can figure that one out.
Nice
There is also a precedence factor known as the nice number. The higher the nice, the more CPU time a process is allowed to have.
Now we can talk about managing these processes. Stay tuned!
Related Stories
POSTED IN: How To
0 opinions for HOWTO: Monitor Processes
No one has left a comment yet. You know what this means, right? You could be first!
Have an opinion? Leave a comment: