<s>
Spawn	B-Language
in	O
computing	O
refers	O
to	O
a	O
function	O
that	O
loads	O
and	O
executes	B-General_Concept
a	O
new	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
The	O
current	B-Operating_System
process	I-Operating_System
may	O
wait	O
for	O
the	O
child	O
to	O
terminate	O
or	O
may	O
continue	O
to	O
execute	O
concurrent	B-Architecture
computing	I-Architecture
.	O
</s>
<s>
Creating	O
a	O
new	O
subprocess	B-Operating_System
requires	O
enough	O
memory	O
in	O
which	O
both	O
the	O
child	B-Operating_System
process	I-Operating_System
and	O
the	O
current	O
program	O
can	O
execute	O
.	O
</s>
<s>
There	O
is	O
a	O
family	O
of	O
spawn	B-Language
functions	O
in	O
DOS	B-Device
,	O
inherited	O
by	O
Microsoft	B-Application
Windows	I-Application
.	O
</s>
<s>
The	O
DOS/Windows	O
spawn	B-Language
functions	O
are	O
inspired	O
by	O
Unix	B-Application
functions	O
fork	B-Operating_System
and	I-Operating_System
exec	I-Operating_System
;	O
however	O
,	O
as	O
these	O
operating	O
systems	O
do	O
not	O
support	O
fork	B-Language
,	O
the	O
spawn	B-Language
function	O
was	O
supplied	O
as	O
a	O
replacement	O
for	O
the	O
fork-exec	B-Operating_System
combination	O
.	O
</s>
<s>
However	O
,	O
the	O
spawn	B-Language
function	O
,	O
although	O
it	O
deals	O
adequately	O
with	O
the	O
most	O
common	O
use	O
cases	O
,	O
lacks	O
the	O
full	O
power	O
of	O
fork-exec	B-Operating_System
,	O
since	O
after	O
fork	B-Language
any	O
process	O
settings	O
which	O
will	O
survive	O
an	O
exec	B-Operating_System
may	O
be	O
changed	O
.	O
</s>
<s>
In	O
the	O
spawnl	B-Language
,	O
,	O
spawnv	O
,	O
and	O
calls	O
,	O
the	O
child	B-Operating_System
process	I-Operating_System
inherits	O
the	O
environment	O
of	O
the	O
parent	O
.	O
</s>
<s>
Files	O
that	O
are	O
open	O
when	O
a	O
spawn	B-Language
call	O
is	O
made	O
remain	O
open	O
in	O
the	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
The	O
base	O
name	O
of	O
each	O
function	O
is	O
spawn	B-Language
,	O
followed	O
by	O
one	O
or	O
more	O
letters	O
:	O
</s>
<s>
eAn	O
array	O
of	O
pointers	O
to	O
environment	O
arguments	O
is	O
explicitly	O
passed	O
to	O
the	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
Name	O
NotesP_OVERLAYOverlays	O
parent	B-Operating_System
process	I-Operating_System
with	O
child	O
,	O
which	O
destroys	O
the	O
parent	O
.	O
</s>
<s>
This	O
has	O
the	O
same	O
effect	O
as	O
the	O
exec*	O
functions.P_WAITSuspends	O
parent	B-Operating_System
process	I-Operating_System
until	O
the	O
child	B-Operating_System
process	I-Operating_System
has	O
finished	O
executing	O
(	O
synchronous	O
spawn	B-Language
)	O
.P_NOWAIT	O
,	O
P_NOWAITOContinues	O
to	O
execute	O
calling	O
process	O
concurrently	O
with	O
new	O
process	O
(	O
asynchronous	O
spawn	B-Language
)	O
.P_DETACHthe	O
child	O
is	O
run	O
in	O
background	O
without	O
access	O
to	O
the	O
console	O
or	O
keyboard	O
.	O
</s>
<s>
For	O
and	O
only	O
,	O
if	O
the	O
filename	O
does	O
not	O
have	O
a	O
path	O
and	O
is	O
not	O
in	O
the	O
current	O
directory	O
,	O
the	O
PATH	B-Application
environment	I-Application
variable	I-Application
determines	O
which	O
directories	O
to	O
search	O
for	O
the	O
file	O
.	O
</s>
<s>
The	O
command	O
line	O
passed	O
to	O
the	O
spawned	O
program	O
is	O
made	O
up	O
of	O
the	O
character	O
strings	O
,	O
arg0	O
through	O
,	O
in	O
the	O
spawn	B-Language
call	O
.	O
</s>
<s>
The	O
spawnle	B-Language
,	O
,	O
,	O
and	O
calls	O
allow	O
the	O
user	O
to	O
alter	O
the	O
child	B-Operating_System
process	I-Operating_System
's	O
environment	O
by	O
passing	O
a	O
list	O
of	O
environment	O
settings	O
in	O
the	O
argument	O
.	O
</s>
<s>
Under	O
Microsoft	B-Application
Windows	I-Application
,	O
the	O
spawn*	O
functions	O
use	O
LoadModule	O
to	O
run	O
the	O
spawned	O
process	O
;	O
and	O
if	O
this	O
fails	O
,	O
an	O
attempt	O
is	O
made	O
to	O
spawn	B-Language
a	O
normal	O
MS-DOS	O
process	O
.	O
</s>
<s>
A	O
positive	O
value	O
indicates	O
that	O
the	O
spawned	O
program	O
executed	O
,	O
but	O
was	O
aborted	B-Application
or	O
ended	O
in	O
error	O
,	O
the	O
value	O
returned	O
is	O
the	O
exit	O
status	O
of	O
the	O
child	B-Operating_System
process	I-Operating_System
.	O
</s>
<s>
Under	O
Microsoft	B-Application
Windows	I-Application
,	O
spawn	B-Language
returns	O
the	O
negated	O
error	O
code	O
returned	O
from	O
LoadModule	O
for	O
compatibility	O
with	O
the	O
C	O
run-time	O
library	O
.	O
</s>
<s>
ValueNotes-2	O
File	O
not	O
found	O
-3	O
Path	O
not	O
found	O
-11	O
Invalid	O
.exe	O
file	O
(	O
for	O
Windows	O
)	O
-13	O
DOS	B-Device
4	O
.	O
</s>
<s>
The	O
and	O
its	O
sibling	O
posix_spawnp	O
can	O
be	O
used	O
as	O
replacements	O
for	O
fork	B-Operating_System
and	I-Operating_System
exec	I-Operating_System
,	O
but	O
does	O
not	O
provide	O
the	O
same	O
flexibility	O
as	O
using	O
fork	B-Operating_System
and	I-Operating_System
exec	I-Operating_System
separately	O
.	O
</s>
<s>
They	O
may	O
be	O
efficient	O
replacements	O
for	O
fork	B-Operating_System
and	I-Operating_System
exec	I-Operating_System
,	O
but	O
their	O
purpose	O
is	O
to	O
provide	O
process	O
creation	O
primitives	O
in	O
embedded	O
environments	O
where	O
fork	B-Language
is	O
not	O
supported	O
due	O
to	O
lack	O
of	O
dynamic	B-Architecture
address	I-Architecture
translation	I-Architecture
.	O
</s>
<s>
The	O
spawn	B-Language
metaphor	O
,	O
i.e.	O
,	O
to	O
produce	O
offspring	O
as	O
in	O
egg	O
deposition	O
,	O
had	O
its	O
early	O
use	O
in	O
the	O
VMS	B-Operating_System
,	O
now	O
OpenVMS	B-Operating_System
,	O
operating	O
system	O
(	O
1977	O
)	O
.	O
</s>
<s>
In	O
academia	O
,	O
there	O
existed	O
a	O
lively	O
debate	O
between	O
proponents	O
of	O
the	O
Unix	B-Application
fork	B-Language
(	O
crude	O
copy	O
of	O
memory	O
layout	O
,	O
but	O
fast	O
)	O
versus	O
VMS	B-Operating_System
's	O
spawn	B-Language
(	O
reliable	O
construction	O
of	O
process	O
parameters	O
,	O
but	O
slower	O
)	O
.	O
</s>
<s>
This	O
debate	O
revived	O
when	O
the	O
VMS	B-Operating_System
spawning	O
mechanism	O
was	O
inherited	O
by	O
Windows	B-Device
NT	I-Device
(	O
1993	O
)	O
.	O
</s>
