Processes
Description
A process is an instance of a running program. On POSIX-compatible systems each process is identified by a unique number called a PID (Process ID), associated with which is a collection of system resources for use by the program. These include:
- the address space within which the program is executing;
- one or more threads;
- the argument vector (
argv
) and environment (envp
); - the current working directory,
umask
, and filesystem root; and - any open file descriptors associated with the process.
New processes can be created by calling the fork
function. They can terminate themselves by calling the exit
function, or be terminated by receiving one of the signals SIGTERM
, SIGINT
, SIGQUIT
or SIGKILL
. Processes can be monitored using the ps
or top
commands.
microHOWTOs
- Capture the output of a child process in C
- Cause a process to become a daemon
- Cause a process to become a daemon in C
- Inspect the current working directory of a running process
- Inspect the umask of a running process
- List all open file descriptors for a given process
- Reap zombie processes using a SIGCHLD handler
Further reading
- getpid, Base Specifications, Issue 7, The Open Group, 2008
- fork, Base Specifications, Issue 7, The Open Group, 2008
- exit, Base Specifications, Issue 7, The Open Group, 2008
- <signal.h>, Base Specifications, Issue 7, The Open Group, 2008