Signals, job control and pipes

Overview of job control

Job Control is a feature supported by the BSD UNIX operating system. It is also an optional part of the IEEE P1003.1 POSIX standard. Job Control breaks a login session into smaller units called jobs. Each job consists of one or more related and cooperating processes. One job, the foreground job, is given complete access to the controlling terminal. The other jobs, called background jobs, are denied read access to the controlling terminal and given conditional write and ioctl access to it. The user may stop an executing job and resume the stopped job either in the foreground or in the background.

Under Job Control, background jobs do not receive events generated by the terminal and are not informed with a hangup indication when the controlling process exits. Background jobs that linger after the login session has been dissolved are prevented from further access to the controlling terminal, and do not interfere with the creation of new login sessions.

If _POSIX_JOB_CONTROL is defined, UNIX System V supports job-control and command interpreter processes supporting job-control can assign the terminal to different jobs, or process-groups, by placing related processes in a single process-group and assigning the process-group with the terminal. A process may examine or change the foreground process-group of a terminal assuming the process has the required permissions (see tcgetpgrp in termios(3C) and tcsetpgrp in termios(3C)). The termios facility aids in this assignment by restricting access to the terminal by processes outside of the foreground process-group (see ``Terminal access control'').

When there is no longer any process whose process-id or process-group-id matches the process-group-id of the foreground process-group, the terminal lacks any foreground process-group. It is unspecified whether the terminal has a foreground process-group when there is no longer any process whose process-group-id matches the process-group-id of the foreground process-group, but there is a process whose process-id matches the process-group-id of the foreground process-group. Only a successful call to tcsetpgrp or assignment of the controlling terminal as described can make a process-group the foreground process-group of a terminal (see tcsetpgrp in termios(3C)).

Background process-groups in the session of the session-leader are subject to a job-control line-discipline when they attempt to access their controlling terminal. Typically, they are sent a signal that causes them to stop, unless they have made other arrangements (see signal(5)). An exception is made for processes that belong to a orphaned process-group, which is a process-group none of whose members have a parent in another process-group within the same session and thus share the same controlling terminal. When these processes attempt to access their controlling terminal, they return errors, because there is no process to continue them if they should stop (see ``Terminal access control'').

Next topic: Job control terminology
Previous topic: Job control and session management

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004