Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

9


Process Relationships


9.1 Introduction


We learned in the previous chapter that thereare relationships between processes. First,
every process has a parent process (the initial kernel-level process is usually its own
parent). The parent is notified when the child terminates, and the parent can obtain the
child’s exit status.We also mentioned process groups when we described thewaitpid
function (Section 8.6) and explained how we can wait for any process in a process group
to terminate.
In this chapter,we’ll look at process groups in moredetail and the concept of
sessions that was introduced by POSIX.1. We’ll also look at the relationship between
the login shell that is invoked for us when we log in and all the processes that we start
from our login shell.
It is impossible to describe these relationships without talking about signals, and to
talk about signals, we need many of the concepts in this chapter.Ifyou areunfamiliar
with the UNIX System signal mechanism, you may want to skim through Chapter 10 at
this point.

9.2 Ter minal Logins


Let’s start by looking at the programs that areexecuted when we log in to a UNIX
system. In early UNIX systems, such as Version 7, users logged in using dumb
terminals that wereconnected to the host with hard-wired connections. The terminals
wereeither local (directly connected) or remote (connected through a modem). In either
case, these logins came through a terminal device driver in the kernel. For example, the

285
Free download pdf