ptg10805159
310 Process Relationships Chapter 9
9.11 FreeBSD Implementation
Having talked about the various attributes of a process, process group, session, and
controlling terminal, it’s worth looking at how all this can be implemented. We’ll look
briefly at the implementation used by FreeBSD. Some details of the SVR4
implementation of these features can be found in Williams[ 1989 ].Figure9.13 shows the
various data structures used by FreeBSD.
p_pglist
p_pid
p_pptr
p_pgrp
procstructure
p_pglist
p_pid
p_pptr
p_pgrp
procstructure
p_pglist
p_pid
p_pptr
p_pgrp
procstructure
pg_id
pg_session
pg_members
pgrpstructure
s_count
s_leader
s_ttyvp
s_ttyp
s_sid
sessionstructure
v_data
t_session vnodestructure
t_pgrp
t_termios
t_winsize
ttystructure
foreground
process group
linked list of
process group members
Figure 9.13 FreeBSD implementation of sessions and process groups
Let’s look at all the fields that we’ve labeled, starting with thesessionstructure.
One of these structures is allocated for each session (e.g., each timesetsidis called).
- s_countis the number of process groups in the session. When this counter is
decremented to 0, the structurecan be freed.