|
The ps command displays information about active processes. Example:
ps -au
USER PID %CPU %MEM SZ RSS STAT TIME COMMAND
me 1435 12.5 21.0 15098 12058 R 2:50 doit
you 1867 9.6 0.6 536 400 S 0:00 ls
root 234 0.0 0.2 300 128 S 0:01 vi
eric 5679 0 0 0 0 Z 0:12 <defunct>
Each Unix vendor seems to provide their own interpretation of the
'standard' ps command. The following is
a representative example of the types of data available:
| USER |
The user who owns the process. |
| PID |
The process identification assigned to the process when it
was initiated by the system. Each process id is unique.
|
| %CPU |
The percentage of CPU time used by this process. It is
calculated by the formula:
(user time + system time) / (present time — start time) |
| %MEM |
The percentage of physical memory occupied by this process. |
| SZ |
The amount of non-shared memory in kilobytes allocated
to the process. This includes the program's statically and dynamically
allocated data area, but not the text area which is normally shared. |
| RSS |
The resident set size of the process in kilobytes. It is the
amount of physical memory currently allocated to the process. |
| STATUS |
One to four letters indicating the status of the process.
The first letter is the most important and indicates if the process is runnable or not
runnable.
| R |
Process is runnable |
| T |
Process is currently stopped |
| P |
Process is currently waiting for a page-in |
| D |
Process is waiting for disk I/O |
| S |
Process has been sleeping less than 20 seconds |
| I |
Process is idle (it has been sleeping for more than 20
seconds) |
| Z |
Process has terminated but not died yet. These are called
Zombies. |
Zombies are usually processes waiting for their parent process. Some
remain until the system reboots. They do not consume any resources other
than an entry in the system table.
The second letter indicates the status of the process with respect to
memory management. A W indicates the process has been swapped out.
The third letter indicates the scheduling priority. An N indicates it
is running at a lower priority. A < indicates it is running at a higher
priority.
The fourth letter indicates if the process has instructed the kernel of
any special memory requirements.
|
Note
ps aux | head -11 will give the top
ten processes
defunct processes are processes that are in the process of closing.
Under some Unix's there are two version of ps, the normal bin version and
the compatibility version (normally in /usr/ucb/bin). By default the ucb
version takes a snaphsot of the process structure and reports on it.
Depending on your Unix the standard path version will open the process
structure and process it dynamically, this can lead to confusion as the
process ID might tally through the report.
|