<s>
Chain	B-Operating_System
loading	I-Operating_System
is	O
a	O
method	O
used	O
by	O
computer	B-Application
programs	I-Application
to	O
replace	O
the	O
currently	O
executing	O
program	O
with	O
a	O
new	O
program	O
,	O
using	O
a	O
common	B-Operating_System
data	I-Operating_System
area	I-Operating_System
to	O
pass	O
information	O
from	O
the	O
current	O
program	O
to	O
the	O
new	O
program	O
.	O
</s>
<s>
Chain	B-Operating_System
loading	I-Operating_System
is	O
similar	O
to	O
the	O
use	O
of	O
overlays	B-General_Concept
.	O
</s>
<s>
Unlike	O
overlays	B-General_Concept
,	O
however	O
,	O
chain	B-Operating_System
loading	I-Operating_System
replaces	O
the	O
currently	O
executing	O
program	O
in	O
its	O
entirety	O
.	O
</s>
<s>
Overlays	B-General_Concept
usually	O
replace	O
only	O
a	O
portion	O
of	O
the	O
running	O
program	O
.	O
</s>
<s>
Like	O
the	O
use	O
of	O
overlays	B-General_Concept
,	O
the	O
use	O
of	O
chain	B-Operating_System
loading	I-Operating_System
increases	O
the	O
I/O	B-General_Concept
load	O
of	O
an	O
application	O
.	O
</s>
<s>
In	O
operating	O
system	O
boot	B-Application
manager	I-Application
programs	O
,	O
chain	B-Operating_System
loading	I-Operating_System
is	O
used	O
to	O
pass	O
control	O
from	O
the	O
boot	B-Application
manager	I-Application
to	O
a	O
boot	B-Device
sector	I-Device
.	O
</s>
<s>
The	O
target	O
boot	B-Device
sector	I-Device
is	O
loaded	O
in	O
from	O
disk	B-Device
,	O
replacing	O
the	O
in-memory	O
boot	B-Device
sector	I-Device
from	O
which	O
the	O
boot	B-Application
manager	I-Application
itself	O
was	O
bootstrapped	O
,	O
and	O
executed	O
.	O
</s>
<s>
In	O
Unix	B-Application
(	O
and	O
in	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
)	O
,	O
the	O
exec( )	O
system	O
call	O
is	O
used	O
to	O
perform	O
chain	B-Operating_System
loading	I-Operating_System
.	O
</s>
<s>
The	O
program	O
image	O
of	O
the	O
current	O
process	B-Operating_System
is	O
replaced	O
with	O
an	O
entirely	O
new	O
image	O
,	O
and	O
the	O
current	O
thread	O
begins	O
execution	O
of	O
that	O
image	O
.	O
</s>
<s>
The	O
common	B-Operating_System
data	I-Operating_System
area	I-Operating_System
comprises	O
the	O
process	B-Operating_System
 '	O
environment	O
variables	O
,	O
which	O
are	O
preserved	O
across	O
the	O
system	O
call	O
.	O
</s>
<s>
In	O
addition	O
to	O
the	O
process	B-Operating_System
level	O
chain	B-Operating_System
loading	I-Operating_System
Linux	B-Application
supports	O
the	O
system	O
call	O
to	O
replace	O
the	O
entire	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
with	O
a	O
different	O
version	O
.	O
</s>
<s>
The	O
new	O
kernel	B-Operating_System
boots	O
as	O
if	O
it	O
were	O
started	O
from	O
power	O
up	O
and	O
no	O
running	O
processes	O
are	O
preserved	O
.	O
</s>
<s>
In	O
BASIC	B-Language
programs	O
,	O
chain	B-Operating_System
loading	I-Operating_System
is	O
the	O
purview	O
of	O
the	O
CHAIN	O
statement	O
(	O
or	O
,	O
in	O
Commodore	B-Language
BASIC	I-Language
,	O
the	O
LOAD	O
statement	O
)	O
,	O
which	O
causes	O
the	O
current	O
program	O
to	O
be	O
terminated	O
and	O
the	O
chained-to	O
program	O
to	O
be	O
loaded	O
and	O
invoked	O
(	O
with	O
,	O
on	O
those	O
dialects	O
of	O
BASIC	B-Language
that	O
support	O
it	O
,	O
an	O
optional	O
parameter	O
specifying	O
the	O
line	B-Application
number	I-Application
from	O
which	O
execution	O
is	O
to	O
commence	O
,	O
rather	O
than	O
the	O
default	O
of	O
the	O
first	O
line	O
of	O
the	O
new	O
program	O
)	O
.	O
</s>
<s>
The	O
common	B-Operating_System
data	I-Operating_System
area	I-Operating_System
varies	O
according	O
to	O
the	O
particular	O
dialect	O
of	O
BASIC	B-Language
that	O
is	O
in	O
use	O
.	O
</s>
<s>
On	O
BBC	B-Language
BASIC	I-Language
,	O
for	O
example	O
,	O
only	O
a	O
specific	O
subset	O
of	O
all	O
variables	O
are	O
preserved	O
across	O
a	O
CHAIN	O
.	O
</s>
<s>
Chain	B-Operating_System
loading	I-Operating_System
permits	O
BASIC	B-Language
programs	O
to	O
execute	O
more	O
program	O
code	O
than	O
could	O
fit	O
into	O
available	O
program	O
and	O
variable	O
memory	O
.	O
</s>
<s>
Applications	O
written	O
in	O
BASIC	B-Language
could	O
thus	O
be	O
far	O
larger	O
than	O
the	O
size	O
of	O
working	O
memory	O
,	O
via	O
a	O
set	O
of	O
cooperating	O
programs	O
that	O
CHAIN	O
back	O
and	O
forth	O
amongst	O
themselves	O
as	O
program	O
flow	O
moves	O
within	O
the	O
overall	O
application	O
.	O
</s>
<s>
Many	O
versions	O
of	O
Fortran	B-Application
include	O
a	O
CALL	O
CHAIN	O
or	O
CALL	O
LINK	O
statement	O
that	O
performs	O
chain	B-Operating_System
loading	I-Operating_System
,	O
preserving	O
the	O
contents	O
of	O
COMMON	B-Operating_System
storage	I-Operating_System
.	O
</s>
<s>
This	O
is	O
not	O
the	O
same	O
as	O
the	O
unrelated	O
LINK	O
subroutine	O
in	O
GNU	B-Application
Fortran	I-Application
.	O
</s>
<s>
OS/360	B-Application
and	I-Application
successors	I-Application
use	O
the	O
XCTL	O
(	O
for	O
"	O
transfer	O
control	O
"	O
)	O
macro	O
for	O
chain	B-Operating_System
loading	I-Operating_System
.	O
</s>
