z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Using job control in the shells

z/OS UNIX System Services User's Guide
SA23-2279-00

When you enter a shell command, you start a process, the execution of a function. When you enter that command, the shell runs it in its own process group. As such, it is considered a separate job and the shell assigns it a job identifier, which is a small number known only to the shell. (A shell job identifier identifies a shell job, not an MVS™ job.) When the process completes, the system displays the shell prompt.

The system also assigns a process group identifier (PGID) and a process identifier (PID). When only one command is entered, the PGID is the same as the PID. The PGID can be thought of as a systemwide identifier. If you enter more than one command at a time using a pipe, several processes, each with its own PID, are started. However, these processes all have the same PGID and shell job identifier. The PGID is the same as the PID of the first process in the pipe.

To sum it up, there are several types of process identifiers associated with a process:
PID
A process ID (PID) is a unique identifier assigned to a process while it runs. When the process ends, its PID is returned to the system. Each time you run a process, it has a different PID (it takes a long time for a PID to be reused by the system). You can use the PID to track the status of a process with the ps command or the jobs command, or to end a process with the kill command.
PGID
Each process in a process group shares a process group ID (PGID), which is the same as the PID of the first process in the process group. This ID is used for signaling related processes.

If a command starts just one process, its PID and PGID are the same.

PPID
A process that creates a new process is called a parent process; the new process is called a child process. The parent process ID (PPID) becomes associated with the new child process when it is created. The PPID is not used for job control.

Several job control commands can either take as input or return the job identifier, process identifier, or process group identifier: bg, fg, jobs, kill, and wait.

The nice and renice commands can be used to change the priority of processes. Their use is dependent on the way performance groups have been prioritized at your installation; check with your system administrator for information about using nice and renice to change job priority.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014