ptg10805159310 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_pptrp_pgrpprocstructure
p_pglist
p_pid
p_pptrp_pgrpprocstructure
p_pglist
p_pid
p_pptrp_pgrpprocstructurepg_id
pg_session
pg_memberspgrpstructures_count
s_leader
s_ttyvp
s_ttyp
s_sidsessionstructurev_datat_session vnodestructure
t_pgrp
t_termiost_winsizettystructureforeground
process grouplinked list of
process group membersFigure 9.13 FreeBSD implementation of sessions and process groupsLet’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.