Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

w(1)

getpriority(2)

getrlimit(2)

wait(2)

vadvise(2)

nice(3C)

termio(4)

pstat(8)

PS(1)  —  USER COMMANDS

NAME

ps − display the status of current processes

SYNOPSIS

ps [ [−] acCegklnrStuUvwx ] [ num ] [ kernel_name ] [ c_dump_file ] [ swap_file ]

DESCRIPTION

ps displays information about processes.  Normally, only those processes that are running with your effective user ID and are attached to a controlling terminal (see termio(4)) are shown.  Additional categories of processes can be added to the display using various options.  In particular, the −a option allows you to include processes that are not owned by you (that do not have your user ID), and the −x option allows you to include processes without control terminals.  When you specify both −a and −x, you get processes owned by anyone, with or without a control terminal.  The −r option restricts the list of processes printed to “running” processes: runnable processes, those in page wait, or those in disk or other short-term waits. 

ps displays the process ID, under PID; the control terminal (if any), under TT; the cpu time used by the process so far, including both user and system time), under TIME; the state of the process, under STAT; and finally, an indication of the COMMAND that is running. 

The state is given by a sequence of four letters, for example, ‘RWNA’. 

First letter indicates the runnability of the process:

R Runnable processes,

T Stopped processes,

P Processes in page wait,

D Processes in disk (or other short term) waits,

S Processes sleeping for less than about 20 seconds,

I Processes that are idle (sleeping longer than about 20 seconds),

Z Processes that have terminated and that are waiting for their parent process to do a wait(2) (“zombie” processes). 

Second letter indicates whether a process is swapped out;

blank (that is, a SPACE character) in this position indicates that the process is loaded (in memory). 

W Process is swapped out. 

> Process has specified a soft limit on memory requirements and has exceeded that limit; such a process is (necessarily) not swapped. 

Third letter indicates whether a process is running with altered CPU scheduling priority (nice):

blank (that is, a SPACE character) in this position indicates that the process is running without special treatment. 

N The process priority is reduced,

< The process priority has been raised artificially. 

Fourth letter indicates any special treatment of the process for virtual memory replacement.  The letters correspond to options to the vadvise(2) system call.  Currently the possibilities are:

blank (that is, a SPACE character) in this position stands for VA_NORM. 

A Stands for VA_ANOM.  An A typically represents a program which is doing garbage collection. 

S Stands for VA_SEQL.  An S is typical of large image processing programs that are using virtual memory to sequentially address voluminous data. 

kernel_name specifies the location of the system namelist.  If the −k option is given, c_dump_file tells ps where to look for the core dump.  Otherwise, the core dump is located in the file /vmcore and this argument is ignored.  swap_file gives the location of a swap file other than the default, /dev/drum. 

OPTIONS

Options must all be combined to form the first argument. 

−a Include information about processes owned by others. 

−c Display the command name, as stored internally in the system for purposes of accounting, rather than the command arguments, which are kept in the process’ address space.  This is more reliable, if less informative, since the process is free to destroy the latter information. 

−C Display raw CPU time in the %CPU field instead of the decaying average. 

−e Display the environment as well as the arguments to the command. 

−g Display all processes.  Without this option, ps only prints “interesting” processes.  Processes are deemed to be uninteresting if they are process group leaders.  This normally eliminates top-level command interpreters and processes waiting for users to login on free terminals. 

−k Normally, kernel_name defaults to /vmunix, c_dump_file is ignored, and swap_file defaults to /dev/drum.  With the −k option in effect, these arguments default to /vmunix, /vmcore, and /dev/drum, respectively. 

−l Display a long listing, with fields F, PPID, CP, PRI, NI, SZ, RSS and WCHAN as described below. 

−n Produce numerical output for some fields.  In a long listing, the WCHAN field is printed numerically rather than symbolically, or, in a user listing, the USER field is replaced by a UID field. 

−r Restrict output to “running” processes. 

−S Display accumulated CPU time used by this process and all of its reaped children. 

tx Restrict output to processes whose controlling terminal is x (which should be specified as printed by ps, for example, t3 for /dev/tty3, tco for /dev/console, td0 for /dev/ttyd0, t?  for processes with no terminal, etc).  This option must be the last one given. 

−u Display user-oriented output.  This includes fields USER, %CPU, %MEM, SZ, RSS and START as described below. 

−U Update a private database where ps keeps system information.  Thus, ‘ps −U’ should be included in the /etc/rc file. 

−v Display a version of the output containing virtual memory.  This includes fields RE, SL, PAGEIN, SIZE, RSS, LIM, %CPU and %MEM, described below. 

−w Use a wide output format (132 columns rather than 80); if repeated, that is, −ww, use arbitrarily wide output.  This information is used to decide how much of long commands to print. 

−x Include processes with no controlling terminal. 

num A process number may be given, in which case the output is restricted to that process.  This option must also be last. 

DISPLAY FORMATS

USER Name of the owner of the process. 

%CPU CPU utilization of the process; this is a decaying average over up to a minute of previous (real) time.  Since the time base over which this is computed varies (since processes may be very young) it is possible for the sum of all %CPU fields to exceed 100%. 

NI Process scheduling increment (see getpriority(2) and nice(3C).) 

SIZE

SZ The combined size of the data and stack segments (in kilobyte units)

RSS Real memory (resident set) size of the process (in kilobyte units). 

LIM Soft limit on memory used, specified using a call to getrlimit(2); if no limit has been specified then shown as xx.

%MEM Percentage of real memory used by this process. 

RE Residency time of the process (seconds in core). 

SL Sleep time of the process (seconds blocked). 

PAGEIN Number of disk I/O’s resulting from references by the process to pages not loaded in core. 

UID Numerical user-ID of process owner. 

PPID Numerical ID of parent of process. 

CP Short-term CPU utilization factor (used in scheduling). 

PRI Process priority (non-positive when in non-interruptible wait). 

START Time the process was created if that was today, or the date it was created if that was before today. 

WCHAN Event on which process is waiting (an address in the system).  A symbol is chosen that classifies the address, unless numerical output is requested (see the n flag).  In this case, the address is printed in hexadecimal. 

F Flags associated with process as in <sys/proc.h>:. 

SLOAD0000001in core
SSYS0000002swapper or pager process
SLOCK0000004process being swapped out
SSWAP0000008save area flag
STRC0000010process is being traced
SWTED0000020parent has been told that this process stopped
SULOCK0000040user settable lock in core
SPAGE0000080process in page wait state
SKEEP0000100another flag to prevent swap out
SOMASK0000200restore old mask after taking signal
SWEXIT0000400working on exiting
SPHYSIO0000800doing physical I/O
SVFORK0001000process resulted from vfork()
SVFDONE0002000another vfork flag
SNOVM0004000no vm, parent in a vfork()
SPAGI0008000init data space on demand, from inode
SSEQL0010000user warned of sequential vm behavior
SUANOM0020000user warned of anomalous vm behavior
STIMO0040000timing out during sleep
SPGLDR0080000process is session process group leader
STRACNG0100000process is tracing another process
SOWEUPC0200000owe process an addupc() call at next ast
SSEL0400000selecting; wakeup/waiting danger
SFAVORD2000000favored treatment in swapout and pageout
SLKDONE4000000record-locking has been done
STRCSYS8000000tracing system calls

A process that has exited and has a parent, but has not yet been waited for by the parent is marked <defunct>; a process that is blocked trying to exit is marked <exiting>; otherwise, ps makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area.  The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be counted on too much. 

FILES

/vmunix system namelist

/dev/kmem kernel memory

/dev/drum swap device

/vmcore core file

/dev searched to find swap device and terminal names

/etc/psdatabase system namelist, device, and wait channel information

SEE ALSO

kill(1), w(1), getpriority(2), getrlimit(2), wait(2), vadvise(2), nice(3C), termio(4), pstat(8)

BUGS

Things can change while ps is running; the picture it gives is only a close approximation to the current state. 

Sun Release 4.0  —  Last change: 25 March 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026