Penguin
Note: You are viewing an old revision of this page. View the current version.

The controlling terminal of a Process is the terminal at which a user is presumed to be sitting who is interacting with the process. If a process has a controlling terminal, it is said to be attached to the terminal; a process can have no controlling terminal, in which case it is said to be a detached process.

When you log into a UNIX system, a shell process is created to accept commands you type at the keyboard and act on them. This process has as its controlling terminal the terminal at which you logged in. Other processes started as children of that shell will initially share the same controlling terminal.

A controlling terminal has an associated foreground ProcessGroup; only processes in this group are allowed to read from the terminal (though all processes which may have that terminal currently open are allowed to write to it). Processes in other process groups sharing the same controlling terminal are said to be in the background; if any processes in those groups try to read from this terminal, they will get a SIGSTOP signal which causes them to be suspended until their process group is brought into the foreground.

Also, when you hit CTRL/C, the SIGINT signal is only sent to processes in the foreground process group.