<s>
In	O
a	O
POSIX-conformant	O
operating	B-General_Concept
system	I-General_Concept
,	O
a	O
process	B-Operating_System
group	I-Operating_System
denotes	O
a	O
collection	O
of	O
one	O
or	O
more	O
processes	B-Operating_System
.	O
</s>
<s>
Among	O
other	O
things	O
,	O
a	O
process	B-Operating_System
group	I-Operating_System
is	O
used	O
to	O
control	O
the	O
distribution	O
of	O
a	O
signal	B-Operating_System
;	O
</s>
<s>
when	O
a	O
signal	B-Operating_System
is	O
directed	O
to	O
a	O
process	B-Operating_System
group	I-Operating_System
,	O
the	O
signal	B-Operating_System
is	O
delivered	O
to	O
each	O
process	O
that	O
is	O
a	O
member	O
of	O
the	O
group	O
.	O
</s>
<s>
Similarly	O
,	O
a	O
session	O
denotes	O
a	O
collection	O
of	O
one	O
or	O
more	O
process	B-Operating_System
groups	I-Operating_System
.	O
</s>
<s>
A	O
process	O
may	O
not	O
create	O
a	O
process	B-Operating_System
group	I-Operating_System
that	O
belongs	O
to	O
another	O
session	O
;	O
</s>
<s>
furthermore	O
,	O
a	O
process	O
is	O
not	O
permitted	O
to	O
join	O
a	O
process	B-Operating_System
group	I-Operating_System
that	O
is	O
a	O
member	O
of	O
another	O
sessionthat	O
is	O
,	O
a	O
process	O
is	O
not	O
permitted	O
to	O
migrate	O
from	O
one	O
session	O
to	O
another	O
.	O
</s>
<s>
When	O
a	O
process	O
replaces	O
its	O
image	O
with	O
a	O
new	O
image	O
(	O
by	O
calling	O
one	O
of	O
the	O
exec	B-Operating_System
functions	O
)	O
,	O
the	O
new	O
image	O
is	O
subjected	O
to	O
the	O
same	O
process	B-Operating_System
group	I-Operating_System
(	O
and	O
thus	O
session	O
)	O
membership	O
as	O
the	O
old	O
image	O
.	O
</s>
<s>
The	O
distribution	O
of	O
signals	O
to	O
process	B-Operating_System
groups	I-Operating_System
forms	O
the	O
basis	O
of	O
job	B-Operating_System
control	I-Operating_System
employed	O
by	O
shell	B-Operating_System
programs	I-Operating_System
.	O
</s>
<s>
The	O
TTY	B-General_Concept
device	I-General_Concept
driver	O
incorporates	O
a	O
notion	O
of	O
a	O
foreground	B-Operating_System
process	I-Operating_System
group	I-Operating_System
,	O
to	O
which	O
it	O
sends	O
signals	O
generated	O
by	O
keyboard	B-Device
interrupts	I-Device
,	O
notably	O
SIGINT	B-General_Concept
(	O
"	O
interrupt	O
"	O
,	O
)	O
,	O
SIGTSTP	B-General_Concept
(	O
"	O
terminal	O
stop	O
"	O
,	O
)	O
,	O
and	O
SIGQUIT	B-General_Concept
(	O
"	O
quit	O
"	O
,	O
)	O
.	O
</s>
<s>
It	O
also	O
sends	O
the	O
SIGTTIN	B-General_Concept
and	O
SIGTTOU	B-General_Concept
signals	O
to	O
any	O
processes	B-Operating_System
that	O
attempt	O
to	O
read	O
from	O
or	O
write	O
to	O
the	O
terminal	O
and	O
that	O
are	O
not	O
in	O
the	O
foreground	B-Operating_System
process	I-Operating_System
group	I-Operating_System
.	O
</s>
<s>
The	O
shell	O
,	O
in	O
turn	O
,	O
partitions	O
the	O
command	O
pipelines	B-Operating_System
that	O
it	O
creates	O
into	O
process	B-Operating_System
groups	I-Operating_System
,	O
and	O
controls	O
what	O
process	B-Operating_System
group	I-Operating_System
is	O
the	O
foreground	B-Operating_System
process	I-Operating_System
group	I-Operating_System
of	O
its	O
controlling	O
terminal	O
,	O
thus	O
determining	O
what	O
processes	B-Operating_System
(	O
and	O
thus	O
what	O
command	O
pipelines	B-Operating_System
)	O
may	O
perform	O
I/O	O
to	O
and	O
from	O
the	O
terminal	O
at	O
any	O
given	O
time	O
.	O
</s>
<s>
When	O
the	O
shell	O
forks	B-Language
a	O
new	O
child	B-Operating_System
process	I-Operating_System
for	O
a	O
command	O
pipeline	B-Operating_System
,	O
both	O
the	O
parent	O
shell	O
process	O
and	O
the	O
child	B-Operating_System
process	I-Operating_System
immediately	O
make	O
the	O
child	B-Operating_System
process	I-Operating_System
into	O
the	O
leader	O
of	O
the	O
process	B-Operating_System
group	I-Operating_System
for	O
the	O
command	O
pipeline	B-Operating_System
.	O
</s>
<s>
In	O
this	O
way	O
,	O
it	O
is	O
ensured	O
that	O
the	O
child	O
is	O
the	O
leader	O
of	O
the	O
process	B-Operating_System
group	I-Operating_System
before	O
either	O
the	O
parent	O
or	O
the	O
child	O
relies	O
on	O
this	O
being	O
the	O
case	O
.	O
</s>
<s>
Where	O
a	O
textual	O
user	O
interface	O
is	O
being	O
used	O
on	O
a	O
Unix-like	O
system	O
,	O
sessions	O
are	O
used	O
to	O
implement	O
login	B-Operating_System
sessions	I-Operating_System
.	O
</s>
<s>
A	O
single	O
process	O
,	O
the	O
session	B-Operating_System
leader	I-Operating_System
,	O
interacts	O
with	O
the	O
controlling	O
terminal	O
in	O
order	O
to	O
ensure	O
that	O
all	O
programs	O
are	O
terminated	O
when	O
a	O
user	O
"	O
hangs	O
up	O
"	O
the	O
terminal	O
connection	O
.	O
</s>
<s>
(	O
Where	O
a	O
session	B-Operating_System
leader	I-Operating_System
is	O
absent	O
,	O
the	O
processes	B-Operating_System
in	O
the	O
terminal	O
's	O
foreground	B-Operating_System
process	I-Operating_System
group	I-Operating_System
are	O
expected	O
to	O
handle	O
hangups	O
.	O
)	O
</s>
<s>
Where	O
a	O
graphical	B-Application
user	I-Application
interface	I-Application
is	O
being	O
used	O
,	O
the	O
session	O
concept	O
is	O
largely	O
lost	O
,	O
and	O
the	O
kernel	B-Operating_System
's	O
notion	O
of	O
sessions	O
largely	O
ignored	O
.	O
</s>
<s>
Graphical	B-Application
user	I-Application
interfaces	I-Application
,	O
such	O
as	O
where	O
the	O
X	B-Device
display	I-Device
manager	I-Device
is	O
employed	O
,	O
use	O
a	O
different	O
mechanism	O
for	O
implementing	O
login	B-Operating_System
sessions	I-Operating_System
.	O
</s>
<s>
The	O
system	B-Operating_System
call	I-Operating_System
is	O
used	O
to	O
create	O
a	O
new	O
session	O
containing	O
a	O
single	O
(	O
new	O
)	O
process	B-Operating_System
group	I-Operating_System
,	O
with	O
the	O
current	O
process	O
as	O
both	O
the	O
session	B-Operating_System
leader	I-Operating_System
and	O
the	O
process	B-Operating_System
group	I-Operating_System
leader	I-Operating_System
of	O
that	O
single	O
process	B-Operating_System
group	I-Operating_System
.	O
</s>
<s>
Process	B-Operating_System
groups	I-Operating_System
are	O
identified	O
by	O
a	O
positive	O
integer	O
,	O
the	O
process	B-Operating_System
group	I-Operating_System
ID	I-Operating_System
,	O
which	O
is	O
the	O
process	B-Operating_System
identifier	I-Operating_System
of	O
the	O
process	O
that	O
is	O
(	O
or	O
was	O
)	O
the	O
process	B-Operating_System
group	I-Operating_System
leader	I-Operating_System
.	O
</s>
<s>
Process	B-Operating_System
groups	I-Operating_System
need	O
not	O
necessarily	O
have	O
leaders	O
,	O
although	O
they	O
always	O
begin	O
with	O
one	O
.	O
</s>
<s>
Sessions	O
are	O
identified	O
by	O
the	O
process	B-Operating_System
group	I-Operating_System
ID	I-Operating_System
of	O
the	O
session	B-Operating_System
leader	I-Operating_System
.	O
</s>
<s>
POSIX	O
prohibits	O
the	O
change	O
of	O
the	O
process	B-Operating_System
group	I-Operating_System
ID	I-Operating_System
of	O
a	O
session	B-Operating_System
leader	I-Operating_System
.	O
</s>
<s>
The	O
system	B-Operating_System
call	I-Operating_System
is	O
used	O
to	O
set	O
the	O
process	B-Operating_System
group	I-Operating_System
ID	I-Operating_System
of	O
a	O
process	O
,	O
thereby	O
either	O
joining	O
the	O
process	O
to	O
an	O
existing	O
process	B-Operating_System
group	I-Operating_System
,	O
or	O
creating	O
a	O
new	O
process	B-Operating_System
group	I-Operating_System
within	O
the	O
session	O
of	O
the	O
process	O
with	O
the	O
process	O
becoming	O
the	O
process	B-Operating_System
group	I-Operating_System
leader	I-Operating_System
of	O
the	O
newly	O
created	O
group	O
.	O
</s>
<s>
POSIX	O
prohibits	O
the	O
re-use	O
of	O
a	O
process	B-Operating_System
ID	I-Operating_System
where	O
a	O
process	B-Operating_System
group	I-Operating_System
with	O
that	O
identifier	O
still	O
exists	O
(	O
i.e.	O
</s>
<s>
where	O
the	O
leader	O
of	O
a	O
process	B-Operating_System
group	I-Operating_System
has	O
exited	O
,	O
but	O
other	O
processes	B-Operating_System
in	O
the	O
group	O
still	O
exist	O
)	O
.	O
</s>
<s>
It	O
thereby	O
guarantees	O
that	O
processes	B-Operating_System
may	O
not	O
accidentally	O
become	O
process	B-Operating_System
group	I-Operating_System
leaders	I-Operating_System
.	O
</s>
<s>
The	O
system	B-Operating_System
call	I-Operating_System
kill	O
is	O
capable	O
of	O
directing	O
signals	O
either	O
to	O
individual	O
processes	B-Operating_System
or	O
to	O
process	B-Operating_System
groups	I-Operating_System
.	O
</s>
