Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

312 Process Relationships Chapter 9


Theprocstructurecontains all the information for a single process.


  • p_pidcontains the process ID.

  • p_pptris a pointer to theprocstructure of the parent process.

  • p_pgrppoints to thepgrpstructure of the process group to which this process
    belongs.

  • p_pglistis a structurecontaining pointers to the next and previous processes
    in the process group, as we mentioned earlier.


Finally, we have the vnode structure. This structure is allocated when the
controlling terminal device is opened. All references to/dev/ttyin a process go
through thisvnodestructure.

9.12 Summary


This chapter has described the relationships between groups of processes — sessions,
which aremade up of process groups. Job control is a featuresupported by most UNIX
systems today,and we’ve described how it’s implemented by a shell that supports job
control. The controlling terminal for a process,/dev/tty, is also involved in these
process relationships.
We’ve made numerous references to the signals that areused in all these process
relationships. The next chapter continues the discussion of signals, looking at all the
UNIX System signals in detail.

Exercises


9.1 Refer back to our discussion of theutmpandwtmpfiles in Section 6.8. Why arethe logout
records written by theinitprocess? Is this handled the same way for a network login?
9.2 Write a small program that callsforkand has the child create a new session. Verify that
the child becomes a process group leader and that the child no longer has a controlling
terminal.
Free download pdf