<s>
In	O
computer	B-General_Concept
operating	I-General_Concept
systems	I-General_Concept
,	O
a	O
process	B-Operating_System
(	O
or	O
task	B-General_Concept
)	O
may	O
wait	O
for	O
another	O
process	B-Operating_System
to	O
complete	O
its	O
execution	O
.	O
</s>
<s>
In	O
most	O
systems	O
,	O
a	O
parent	B-Operating_System
process	I-Operating_System
can	O
create	O
an	O
independently	O
executing	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
The	O
parent	B-Operating_System
process	I-Operating_System
may	O
then	O
issue	O
a	O
wait	O
system	B-Operating_System
call	I-Operating_System
,	O
which	O
suspends	O
the	O
execution	O
of	O
the	O
parent	B-Operating_System
process	I-Operating_System
while	O
the	O
child	O
executes	O
.	O
</s>
<s>
When	O
the	O
child	B-Operating_System
process	I-Operating_System
terminates	B-Operating_System
,	O
it	O
returns	O
an	O
exit	B-Operating_System
status	I-Operating_System
to	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
which	O
is	O
then	O
returned	O
to	O
the	O
waiting	O
parent	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
The	O
parent	B-Operating_System
process	I-Operating_System
then	O
resumes	O
execution	O
.	O
</s>
<s>
Modern	O
operating	B-General_Concept
systems	I-General_Concept
also	O
provide	O
system	B-Operating_System
calls	I-Operating_System
that	O
allow	O
a	O
process	B-Operating_System
's	O
thread	B-Operating_System
to	O
create	O
other	O
threads	B-Operating_System
and	O
wait	O
for	O
them	O
to	O
terminate	B-Operating_System
(	O
"	O
join	O
"	O
them	O
)	O
in	O
a	O
similar	O
fashion	O
.	O
</s>
<s>
An	O
operating	B-General_Concept
system	I-General_Concept
may	O
provide	O
variations	O
of	O
the	O
wait	O
call	O
that	O
allow	O
a	O
process	B-Operating_System
to	O
wait	O
for	O
any	O
of	O
its	O
child	O
processes	O
to	O
exit	B-Operating_System
,	O
or	O
to	O
wait	O
for	O
a	O
single	O
specific	O
child	B-Operating_System
process	I-Operating_System
(	O
identified	O
by	O
its	O
process	B-Operating_System
ID	I-Operating_System
)	O
to	O
exit	B-Operating_System
.	O
</s>
<s>
Some	O
operating	B-General_Concept
systems	I-General_Concept
issue	O
a	O
signal	B-Operating_System
(	O
SIGCHLD	B-General_Concept
)	O
to	O
the	O
parent	B-Operating_System
process	I-Operating_System
when	O
a	O
child	B-Operating_System
process	I-Operating_System
terminates	B-Operating_System
,	O
notifying	O
the	O
parent	B-Operating_System
process	I-Operating_System
and	O
allowing	O
it	O
to	O
retrieve	O
the	O
child	B-Operating_System
process	I-Operating_System
's	O
exit	B-Operating_System
status	I-Operating_System
.	O
</s>
<s>
The	O
exit	B-Operating_System
status	I-Operating_System
returned	O
by	O
a	O
child	B-Operating_System
process	I-Operating_System
typically	O
indicates	O
whether	O
the	O
process	B-Operating_System
terminated	O
normally	O
or	O
abnormally	B-Application
.	O
</s>
<s>
For	O
normal	O
termination	O
,	O
this	O
status	O
also	O
includes	O
the	O
exit	B-Operating_System
code	I-Operating_System
(	O
usually	O
an	O
integer	O
value	O
)	O
that	O
the	O
process	B-Operating_System
returned	O
to	O
the	O
system	O
.	O
</s>
<s>
During	O
the	O
first	O
20	O
years	O
of	O
UNIX	O
,	O
only	O
the	O
low	O
8	O
bits	O
of	O
the	O
exit	B-Operating_System
code	I-Operating_System
have	O
been	O
available	O
to	O
the	O
waiting	O
parent	O
.	O
</s>
<s>
In	O
1989	O
with	O
SVR4	O
,	O
a	O
new	O
call	O
waitid	B-Operating_System
has	O
been	O
introduced	O
that	O
returns	O
all	O
bits	O
from	O
the	O
exit	B-Operating_System
call	O
in	O
a	O
structure	O
called	O
siginfo_t	O
in	O
the	O
structure	O
member	O
si_status	O
.	O
</s>
<s>
Waitid	B-Operating_System
is	O
a	O
mandatory	O
part	O
of	O
the	O
POSIX	O
standard	O
since	O
2001	O
.	O
</s>
<s>
When	O
a	O
child	B-Operating_System
process	I-Operating_System
terminates	B-Operating_System
,	O
it	O
becomes	O
a	O
zombie	B-Operating_System
process	I-Operating_System
,	O
and	O
continues	O
to	O
exist	O
as	O
an	O
entry	O
in	O
the	O
system	B-Operating_System
process	I-Operating_System
table	O
even	O
though	O
it	O
is	O
no	O
longer	O
an	O
actively	O
executing	O
program	O
.	O
</s>
<s>
Under	O
normal	O
operation	O
it	O
will	O
typically	O
be	O
immediately	O
waited	O
on	O
by	O
its	O
parent	O
,	O
and	O
then	O
reaped	O
by	O
the	O
system	O
,	O
reclaiming	O
the	O
resource	O
(	O
the	O
process	B-Operating_System
table	I-Operating_System
entry	O
)	O
.	O
</s>
<s>
Such	O
situations	O
are	O
typically	O
handled	O
with	O
a	O
special	O
"	O
reaper	O
"	O
process	B-Operating_System
that	O
locates	O
zombies	O
and	O
retrieves	O
their	O
exit	B-Operating_System
status	I-Operating_System
,	O
allowing	O
the	O
operating	B-General_Concept
system	I-General_Concept
to	O
then	O
deallocate	O
their	O
resources	O
.	O
</s>
<s>
Conversely	O
,	O
a	O
child	B-Operating_System
process	I-Operating_System
whose	O
parent	B-Operating_System
process	I-Operating_System
terminates	B-Operating_System
before	O
it	O
does	O
becomes	O
an	O
orphan	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
Such	O
situations	O
are	O
typically	O
handled	O
with	O
a	O
special	O
"	O
root	O
"	O
(	O
or	O
"	O
init	O
"	O
)	O
process	B-Operating_System
,	O
which	O
is	O
assigned	O
as	O
the	O
new	O
parent	O
of	O
a	O
process	B-Operating_System
when	O
its	O
parent	B-Operating_System
process	I-Operating_System
exits	O
.	O
</s>
<s>
This	O
special	O
process	B-Operating_System
detects	O
when	O
an	O
orphan	B-Operating_System
process	I-Operating_System
terminates	B-Operating_System
and	O
then	O
retrieves	O
its	O
exit	B-Operating_System
status	I-Operating_System
,	O
allowing	O
the	O
system	O
to	O
deallocate	O
the	O
terminated	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
If	O
a	O
child	B-Operating_System
process	I-Operating_System
receives	O
a	O
signal	B-Operating_System
,	O
a	O
waiting	O
parent	O
will	O
then	O
continue	O
execution	O
leaving	O
an	O
orphan	B-Operating_System
process	I-Operating_System
behind	O
.	O
</s>
<s>
Hence	O
it	O
is	O
sometimes	O
needed	O
to	O
check	O
the	O
argument	O
set	O
by	O
wait	O
,	O
waitpid	B-Operating_System
or	O
waitid	B-Operating_System
and	O
,	O
in	O
the	O
case	O
that	O
WIFSIGNALED	O
is	O
true	O
,	O
wait	O
for	O
the	O
child	B-Operating_System
process	I-Operating_System
again	O
to	O
deallocate	O
resources	O
.	O
</s>
