Process Types Process Attributes

2.4 Processes

A process is a single program that is running in its virtual address space. The process should be distinct from a job or a command, which may be composed of many processes working together to perform a specific task. One of the main administrative tasks is to manage UNIX processes. In this section we will cover main process−related topics.

2.4.1 Process Parameters

This is a brief reminder about process parameters. We will start with the process types and main process attributes. Full understanding of process attributes is crucial for certain administrative activities, as well as for the system security. Other discussed issues are file descriptors attached to a process and process states.

2.4.1.1 Process Types

The three distinct types of processes are: Interactive processes — Interactive processes are initiated and controlled by a terminal session; they run in the foreground attached for the standard input STDIN in a terminal session STDIN corresponds to the terminal or in the background. Job control which originated in BSD allows a foreground process to be sent to the background and vice versa. • Batch processes — Processes not associated with a terminal; these are explicitly submitted to a batch queue and executed with a lower priority in sequential order, primarily at off−peak times. Originally, batch processing was not very thoroughly developed on UNIX platforms, but third−party vendors have improved it. Batch processing is very convenient for non−urgent, long−lasting data processing such as iterative calculations and the like. • Daemons — Server background processes, usually initiated at the system boot time, which continue running as long as the system is up. Daemons perform different system−related tasks; they wait in the background until some process requires their service. •

2.4.1.2 Process Attributes

There are many attributes associated with UNIX processes. The following paragraphs discuss the major attributes. Process ID PID — The PID is a unique identifying number used to refer to the process. It is an integer assigned by the kernel when the process was created and cannot be changed for the lifetime of the process. Crucial for process handling, a process is always identified by its PID. • Parent process ID PPID — The PPID is the PID of the parent process, which is the process that was directly involved in the creation of the new process. The PPID is not unique, because the same parent process could have a number of child processes. The PPID cannot be changed during the lifetime of the process. • Real and effective user ID RUID and EUID — The real user ID RUID is the UID of the user who started the process; the effective user ID EUID is the UID used to determine the • 53 • Process group ID PGID —The process group ID PGID identifies the process group that the process belongs to; typically, multiple processes are members of the same process group and they share the same PGID. The PGID is the PID of the process group leader; this is usually the initial parent process. Unlike PID and PPID, which cannot be changed during the life of the process, PGID is under program control and can be changed by the corresponding system call as is the case with job control. PGIDs are important in the processing of signals in interprocess communications. For example: the invoked shell is the process group leader for all subsequent commands that are members of the created process group; once the user logs out and terminates the shell, all currently running related processes will also terminate. • Control terminal TTY — The control terminal is the terminal or pseudo−terminal associated with the created process — the terminal that the process was started from. • Terminal group ID TGID — The terminal group ID TGID is the PID of the process group leader that opened the terminal, which is typically the login shell. • The TGID identifies the control terminal TTY for a process group, i.e., the terminal associated with a process. The TGID is important for job control. • Current working directory CWD — The current working directory CWD defines the starting point for all relatively specified pathnames filenames that do not begin with the character. • Nice number — A number indicating the process priority relative to other processes. Generally, a lower nice number means a higher priority; this is true also when the nice numbers are in the range − 20 to +20 lower number in this case means more negative. •

2.4.1.3 File Descriptors