1credentials(7)         Miscellaneous Information Manual         credentials(7)
2
3
4

NAME

6       credentials - process identifiers
7

DESCRIPTION

9   Process ID (PID)
10       Each  process  has  a unique nonnegative integer identifier that is as‐
11       signed when the process is created using fork(2).  A process can obtain
12       its  PID  using  getpid(2).   A PID is represented using the type pid_t
13       (defined in <sys/types.h>).
14
15       PIDs are used in a range of system calls to identify  the  process  af‐
16       fected  by  the  call, for example: kill(2), ptrace(2), setpriority(2),
17       setpgid(2), setsid(2), sigqueue(3), and waitpid(2).
18
19       A process's PID is preserved across an execve(2).
20
21   Parent process ID (PPID)
22       A process's parent process ID identifies the process that created  this
23       process using fork(2).  A process can obtain its PPID using getppid(2).
24       A PPID is represented using the type pid_t.
25
26       A process's PPID is preserved across an execve(2).
27
28   Process group ID and session ID
29       Each process has a session ID and a process group ID, both  represented
30       using  the  type pid_t.  A process can obtain its session ID using get‐
31       sid(2), and its process group ID using getpgrp(2).
32
33       A child created by fork(2) inherits its parent's session ID and process
34       group  ID.   A  process's session ID and process group ID are preserved
35       across an execve(2).
36
37       Sessions and process groups are abstractions devised to  support  shell
38       job  control.   A process group (sometimes called a "job") is a collec‐
39       tion of processes that share the same process group ID; the shell  cre‐
40       ates  a  new  process  group for the process(es) used to execute single
41       command or pipeline (e.g., the two processes  created  to  execute  the
42       command  "ls | wc"  are placed in the same process group).  A process's
43       group membership can  be  set  using  setpgid(2).   The  process  whose
44       process  ID  is  the  same as its process group ID is the process group
45       leader for that group.
46
47       A session is a collection of processes that share the same session  ID.
48       All  of  the  members  of a process group also have the same session ID
49       (i.e., all of the members of a process group always belong to the  same
50       session,  so  that  sessions and process groups form a strict two-level
51       hierarchy of processes.)  A new session is created when a process calls
52       setsid(2),  which creates a new session whose session ID is the same as
53       the PID of the process that called setsid(2).  The creator of the  ses‐
54       sion is called the session leader.
55
56       All  of  the  processes in a session share a controlling terminal.  The
57       controlling terminal is established when the session leader first opens
58       a  terminal  (unless  the  O_NOCTTY  flag  is  specified  when  calling
59       open(2)).  A terminal may be the controlling terminal of  at  most  one
60       session.
61
62       At  most  one of the jobs in a session may be the foreground job; other
63       jobs in the session are background jobs.  Only the foreground  job  may
64       read  from  the  terminal; when a process in the background attempts to
65       read from the terminal, its process group is  sent  a  SIGTTIN  signal,
66       which suspends the job.  If the