<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
runtime	B-Device
system	I-Device
or	O
runtime	B-Device
environment	I-Device
is	O
a	O
sub-system	O
that	O
exists	O
both	O
in	O
the	O
computer	O
where	O
a	O
program	O
is	O
created	O
,	O
as	O
well	O
as	O
in	O
the	O
computers	O
where	O
the	O
program	O
is	O
intended	O
to	O
be	O
run	O
.	O
</s>
<s>
The	O
name	O
comes	O
from	O
the	O
compile	B-Application
time	I-Application
and	O
runtime	B-Library
division	O
from	O
compiled	B-Language
languages	I-Language
,	O
which	O
similarly	O
distinguishes	O
the	O
computer	O
processes	O
involved	O
in	O
the	O
creation	O
of	O
a	O
program	O
(	O
compilation	B-Language
)	O
and	O
its	O
execution	O
in	O
the	O
target	O
machine	O
(	O
the	O
run	B-Library
time	I-Library
)	O
.	O
</s>
<s>
Most	O
programming	O
languages	O
have	O
some	O
form	O
of	O
runtime	B-Device
system	I-Device
that	O
provides	O
an	O
environment	O
in	O
which	O
programs	O
run	O
.	O
</s>
<s>
This	O
environment	O
may	O
address	O
a	O
number	O
of	O
issues	O
including	O
the	O
management	B-General_Concept
of	O
application	O
memory	B-General_Concept
,	O
how	O
the	O
program	O
accesses	O
variables	O
,	O
mechanisms	O
for	O
passing	O
parameters	O
between	O
procedures	O
,	O
interfacing	O
with	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
and	O
otherwise	O
.	O
</s>
<s>
The	O
compiler	B-Language
makes	O
assumptions	O
depending	O
on	O
the	O
specific	O
runtime	B-Device
system	I-Device
to	O
generate	O
correct	O
code	O
.	O
</s>
<s>
Typically	O
the	O
runtime	B-Device
system	I-Device
will	O
have	O
some	O
responsibility	O
for	O
setting	O
up	O
and	O
managing	O
the	O
stack	B-General_Concept
and	I-General_Concept
heap	I-General_Concept
,	O
and	O
may	O
include	O
features	O
such	O
as	O
garbage	B-General_Concept
collection	I-General_Concept
,	O
threads	B-Operating_System
or	O
other	O
dynamic	B-Language
features	O
built	O
into	O
the	O
language	O
.	O
</s>
<s>
Every	O
programming	O
language	O
specifies	O
an	O
execution	B-Device
model	I-Device
,	O
and	O
many	O
implement	O
at	O
least	O
part	O
of	O
that	O
model	O
in	O
a	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
One	O
possible	O
definition	O
of	O
runtime	B-Device
system	I-Device
behavior	O
,	O
among	O
others	O
,	O
is	O
"	O
any	O
behavior	O
not	O
directly	O
attributable	O
to	O
the	O
program	O
itself	O
"	O
.	O
</s>
<s>
This	O
definition	O
includes	O
putting	O
parameters	O
onto	O
the	O
stack	B-Application
before	O
function	O
calls	O
,	O
parallel	O
execution	O
of	O
related	O
behaviors	O
,	O
and	O
disk	O
I/O	B-General_Concept
.	O
</s>
<s>
By	O
this	O
definition	O
,	O
essentially	O
every	O
language	O
has	O
a	O
runtime	B-Device
system	I-Device
,	O
including	O
compiled	B-Language
languages	I-Language
,	O
interpreted	B-Application
languages	I-Application
,	O
and	O
embedded	O
domain-specific	O
languages	O
.	O
</s>
<s>
Even	O
API-invoked	O
standalone	O
execution	B-Device
models	I-Device
,	O
such	O
as	O
Pthreads	B-Operating_System
(	O
POSIX	B-Operating_System
threads	I-Operating_System
)	O
,	O
have	O
a	O
runtime	B-Device
system	I-Device
that	O
implements	O
the	O
execution	B-Device
model	I-Device
's	O
behavior	O
.	O
</s>
<s>
Most	O
scholarly	O
papers	O
on	O
runtime	B-Device
systems	I-Device
focus	O
on	O
the	O
implementation	O
details	O
of	O
parallel	O
runtime	B-Device
systems	I-Device
.	O
</s>
<s>
A	O
notable	O
example	O
of	O
a	O
parallel	O
runtime	B-Device
system	I-Device
is	O
Cilk	B-Language
,	O
a	O
popular	O
parallel	O
programming	O
model	O
.	O
</s>
<s>
The	O
proto-runtime	O
toolkit	O
was	O
created	O
to	O
simplify	O
the	O
creation	O
of	O
parallel	O
runtime	B-Device
systems	I-Device
.	O
</s>
<s>
In	O
addition	O
to	O
execution	B-Device
model	I-Device
behavior	O
,	O
a	O
runtime	B-Device
system	I-Device
may	O
also	O
perform	O
support	O
services	O
such	O
as	O
type	O
checking	O
,	O
debugging	O
,	O
or	O
code	B-Application
generation	I-Application
and	O
optimization	O
.	O
</s>
<s>
The	O
runtime	B-Device
system	I-Device
is	O
also	O
the	O
gateway	O
through	O
which	O
a	O
running	O
program	O
interacts	O
with	O
the	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
The	O
runtime	B-Device
environment	I-Device
includes	O
not	O
only	O
accessible	O
state	O
values	O
,	O
but	O
also	O
active	O
entities	O
with	O
which	O
the	O
program	O
can	O
interact	O
during	O
execution	O
.	O
</s>
<s>
For	O
example	O
,	O
environment	O
variables	O
are	O
features	O
of	O
many	O
operating	B-General_Concept
systems	I-General_Concept
,	O
and	O
are	O
part	O
of	O
the	O
runtime	B-Device
environment	I-Device
;	O
a	O
running	O
program	O
can	O
access	O
them	O
via	O
the	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
Likewise	O
,	O
hardware	O
devices	O
such	O
as	O
disks	O
or	O
DVD	O
drives	O
are	O
active	O
entities	O
that	O
a	O
program	O
can	O
interact	O
with	O
via	O
a	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
One	O
unique	O
application	O
of	O
a	O
runtime	B-Device
environment	I-Device
is	O
its	O
use	O
within	O
an	O
operating	B-General_Concept
system	I-General_Concept
that	O
only	O
allows	O
it	O
to	O
run	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
from	O
boot	O
until	O
power-down	O
,	O
the	O
entire	O
OS	O
is	O
dedicated	O
to	O
only	O
the	O
application(s )	O
running	O
within	O
that	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
Any	O
other	O
code	O
that	O
tries	O
to	O
run	O
,	O
or	O
any	O
failures	O
in	O
the	O
application(s )	O
,	O
will	O
break	O
the	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
Breaking	O
the	O
runtime	B-Device
environment	I-Device
in	O
turn	O
breaks	O
the	O
OS	O
,	O
stopping	O
all	O
processing	O
and	O
requiring	O
a	O
reboot	O
.	O
</s>
<s>
If	O
the	O
boot	O
is	O
from	O
read-only	O
memory	B-General_Concept
,	O
an	O
extremely	O
secure	O
,	O
simple	O
,	O
single-mission	O
system	O
is	O
created	O
.	O
</s>
<s>
Examples	O
of	O
such	O
directly	O
bundled	O
runtime	B-Device
systems	I-Device
include	O
:	O
</s>
<s>
Between	O
1983	O
and	O
1984	O
,	O
Digital	O
Research	O
offered	O
several	O
of	O
their	O
business	O
and	O
educations	O
applications	O
for	O
the	O
IBM	B-Device
PC	I-Device
on	O
bootable	O
floppy	O
diskettes	O
bundled	O
with	O
SpeedStart	B-Operating_System
CP/M	I-Operating_System
-86	I-Operating_System
,	O
a	O
reduced	O
version	O
of	O
CP/M	B-Operating_System
-86	I-Operating_System
as	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
Some	O
stand-alone	O
versions	O
of	O
Ventura	B-Application
Publisher	I-Application
(	O
1986	O
–	O
1993	O
)	O
,	O
Artline	O
(	O
1988	O
–	O
1991	O
)	O
,	O
Timeworks	B-Application
Publisher	I-Application
(	O
1988	O
–	O
1991	O
)	O
and	O
ViewMAX	B-Application
(	O
1990	O
–	O
1992	O
)	O
contained	O
special	O
runtime	B-Library
versions	O
of	O
Digital	O
Research	O
's	O
GEM	B-Application
as	O
their	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
In	O
the	O
late	O
1990s	O
,	O
JP	B-Application
Software	I-Application
's	O
command	O
line	O
processor	O
4DOS	B-Application
was	O
optionally	O
available	O
in	O
a	O
special	O
runtime	B-Library
version	O
to	O
be	O
linked	O
with	O
BATCOMP	B-Application
pre-compiled	O
and	O
encrypted	O
batch	B-General_Concept
jobs	I-General_Concept
in	O
order	O
to	O
create	O
unmodifyable	O
executables	B-Application
from	O
batch	O
scripts	O
and	O
run	O
them	O
on	O
systems	O
without	O
4DOS	B-Application
installed	O
.	O
</s>
<s>
The	O
runtime	B-Device
system	I-Device
of	O
the	O
C	B-Language
language	I-Language
is	O
a	O
particular	O
set	O
of	O
instructions	O
inserted	O
by	O
the	O
compiler	B-Language
into	O
the	O
executable	B-Application
image	O
.	O
</s>
<s>
Among	O
other	O
things	O
,	O
these	O
instructions	O
manage	O
the	O
process	O
stack	B-Application
,	O
create	O
space	O
for	O
local	O
variables	O
,	O
and	O
copy	O
function	O
call	O
parameters	O
onto	O
the	O
top	O
of	O
the	O
stack	B-Application
.	O
</s>
<s>
There	O
are	O
often	O
no	O
clear	O
criteria	O
for	O
determining	O
which	O
language	O
behaviors	O
are	O
part	O
of	O
the	O
runtime	B-Device
system	I-Device
itself	O
and	O
which	O
can	O
be	O
determined	O
by	O
any	O
particular	O
source	O
program	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C	B-Language
,	O
the	O
setup	O
of	O
the	O
stack	B-Application
is	O
part	O
of	O
the	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
It	O
is	O
not	O
determined	O
by	O
the	O
semantics	B-Application
of	O
an	O
individual	O
program	O
because	O
the	O
behavior	O
is	O
globally	O
invariant	O
:	O
it	O
holds	O
over	O
all	O
executions	O
.	O
</s>
<s>
This	O
systematic	O
behavior	O
implements	O
the	O
execution	B-Device
model	I-Device
of	O
the	O
language	O
,	O
as	O
opposed	O
to	O
implementing	O
semantics	B-Application
of	O
the	O
particular	O
program	O
(	O
in	O
which	O
text	O
is	O
directly	O
translated	O
into	O
code	O
that	O
computes	O
results	O
)	O
.	O
</s>
<s>
This	O
separation	O
between	O
the	O
semantics	B-Application
of	O
a	O
particular	O
program	O
and	O
the	O
runtime	B-Device
environment	I-Device
is	O
reflected	O
by	O
the	O
different	O
ways	O
of	O
compiling	B-Language
a	O
program	O
:	O
compiling	B-Language
source	O
code	O
to	O
an	O
object	B-Application
file	I-Application
that	O
contains	O
all	O
the	O
functions	O
versus	O
compiling	B-Language
an	O
entire	O
program	O
to	O
an	O
executable	B-Application
binary	I-Application
.	O
</s>
<s>
The	O
object	B-Application
file	I-Application
will	O
only	O
contain	O
assembly	O
code	O
relevant	O
to	O
the	O
included	O
functions	O
,	O
while	O
the	O
executable	B-Application
binary	I-Application
will	O
contain	O
additional	O
code	O
that	O
implements	O
the	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
The	O
object	B-Application
file	I-Application
,	O
on	O
one	O
hand	O
,	O
may	O
be	O
missing	O
information	O
from	O
the	O
runtime	B-Device
environment	I-Device
that	O
will	O
be	O
resolved	O
by	O
linking	B-Application
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
the	O
code	O
in	O
the	O
object	B-Application
file	I-Application
still	O
depends	O
on	O
assumptions	O
in	O
the	O
runtime	B-Device
system	I-Device
;	O
for	O
example	O
,	O
a	O
function	O
may	O
read	O
parameters	O
from	O
a	O
particular	O
register	O
or	O
stack	B-Application
location	O
,	O
depending	O
on	O
the	O
calling	O
convention	O
used	O
by	O
the	O
runtime	B-Device
environment	I-Device
.	O
</s>
<s>
Another	O
example	O
is	O
the	O
case	O
of	O
using	O
an	O
application	B-Application
programming	I-Application
interface	I-Application
(	O
API	B-Application
)	O
to	O
interact	O
with	O
a	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
The	O
calls	O
to	O
that	O
API	B-Application
look	O
the	O
same	O
as	O
calls	O
to	O
a	O
regular	O
software	B-Library
library	I-Library
,	O
however	O
at	O
some	O
point	O
during	O
the	O
call	O
the	O
execution	B-Device
model	I-Device
changes	O
.	O
</s>
<s>
The	O
runtime	B-Device
system	I-Device
implements	O
an	O
execution	B-Device
model	I-Device
different	O
from	O
that	O
of	O
the	O
language	O
the	O
library	O
is	O
written	O
in	O
terms	O
of	O
.	O
</s>
<s>
However	O
,	O
a	O
person	O
reading	O
the	O
code	O
of	O
the	O
API	B-Application
that	O
invokes	O
a	O
runtime	B-Device
system	I-Device
would	O
not	O
be	O
able	O
to	O
understand	O
the	O
behavior	O
of	O
the	O
API	B-Application
call	O
just	O
by	O
knowing	O
the	O
language	O
the	O
call	O
was	O
written	O
in	O
.	O
</s>
<s>
At	O
some	O
point	O
,	O
via	O
some	O
mechanism	O
,	O
the	O
execution	B-Device
model	I-Device
stops	O
being	O
that	O
of	O
the	O
language	O
the	O
call	O
is	O
written	O
in	O
and	O
switches	O
over	O
to	O
being	O
the	O
execution	B-Device
model	I-Device
implemented	O
by	O
the	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
For	O
example	O
,	O
the	O
trap	O
instruction	O
is	O
one	O
method	O
of	O
switching	O
execution	B-Device
models	I-Device
.	O
</s>
<s>
This	O
difference	O
is	O
what	O
distinguishes	O
an	O
API-invoked	O
execution	B-Device
model	I-Device
,	O
such	O
as	O
Pthreads	B-Operating_System
,	O
from	O
a	O
usual	O
software	B-Library
library	I-Library
.	O
</s>
<s>
Both	O
Pthreads	B-Operating_System
calls	O
and	O
software	B-Library
library	I-Library
calls	O
are	O
invoked	O
via	O
an	O
API	B-Application
,	O
but	O
Pthreads	B-Operating_System
behavior	O
cannot	O
be	O
understood	O
in	O
terms	O
of	O
the	O
language	O
of	O
the	O
call	O
.	O
</s>
<s>
Rather	O
,	O
Pthreads	B-Operating_System
calls	O
bring	O
into	O
play	O
an	O
outside	O
execution	B-Device
model	I-Device
,	O
which	O
is	O
implemented	O
by	O
the	O
Pthreads	B-Operating_System
runtime	B-Device
system	I-Device
(	O
this	O
runtime	B-Device
system	I-Device
is	O
often	O
the	O
OS	O
kernel	O
)	O
.	O
</s>
<s>
As	O
an	O
extreme	O
example	O
,	O
the	O
physical	O
CPU	O
itself	O
can	O
be	O
viewed	O
as	O
an	O
implementation	O
of	O
the	O
runtime	B-Device
system	I-Device
of	O
a	O
specific	O
assembly	O
language	O
.	O
</s>
<s>
In	O
this	O
view	O
,	O
the	O
execution	B-Device
model	I-Device
is	O
implemented	O
by	O
the	O
physical	O
CPU	O
and	O
memory	B-General_Concept
systems	O
.	O
</s>
<s>
As	O
an	O
analogy	O
,	O
runtime	B-Device
systems	I-Device
for	O
higher-level	O
languages	O
are	O
themselves	O
implemented	O
using	O
some	O
other	O
languages	O
.	O
</s>
<s>
This	O
creates	O
a	O
hierarchy	O
of	O
runtime	B-Device
systems	I-Device
,	O
with	O
the	O
CPU	O
itself	O
—	O
or	O
actually	O
its	O
logic	O
at	O
the	O
microcode	B-Device
layer	O
or	O
below	O
—	O
acting	O
as	O
the	O
lowest-level	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
Some	O
compiled	B-Language
or	O
interpreted	B-Application
languages	I-Application
provide	O
an	O
interface	O
that	O
allows	O
application	O
code	O
to	O
interact	O
directly	O
with	O
the	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
An	O
example	O
is	O
the	O
Thread	B-Operating_System
class	O
in	O
the	O
Java	B-Language
language	I-Language
.	O
</s>
<s>
The	O
class	O
allows	O
code	O
(	O
that	O
is	O
animated	O
by	O
one	O
thread	B-Operating_System
)	O
to	O
do	O
things	O
such	O
as	O
start	O
and	O
stop	O
other	O
threads	B-Operating_System
.	O
</s>
<s>
Normally	O
,	O
core	O
aspects	O
of	O
a	O
language	O
's	O
behavior	O
such	O
as	O
task	O
scheduling	O
and	O
resource	B-General_Concept
management	I-General_Concept
are	O
not	O
accessible	O
in	O
this	O
fashion	O
.	O
</s>
<s>
Higher-level	O
behaviors	O
implemented	O
by	O
a	O
runtime	B-Device
system	I-Device
may	O
include	O
tasks	O
such	O
as	O
drawing	O
text	O
on	O
the	O
screen	O
or	O
making	O
an	O
Internet	O
connection	O
.	O
</s>
<s>
It	O
is	O
often	O
the	O
case	O
that	O
operating	B-General_Concept
systems	I-General_Concept
provide	O
these	O
kinds	O
of	O
behaviors	O
as	O
well	O
,	O
and	O
when	O
available	O
,	O
the	O
runtime	B-Device
system	I-Device
is	O
implemented	O
as	O
an	O
abstraction	B-Architecture
layer	I-Architecture
that	O
translates	O
the	O
invocation	O
of	O
the	O
runtime	B-Device
system	I-Device
into	O
an	O
invocation	O
of	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
This	O
hides	O
the	O
complexity	O
or	O
variations	O
in	O
the	O
services	O
offered	O
by	O
different	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
This	O
also	O
implies	O
that	O
the	O
OS	O
kernel	O
can	O
itself	O
be	O
viewed	O
as	O
a	O
runtime	B-Device
system	I-Device
,	O
and	O
that	O
the	O
set	O
of	O
OS	O
calls	O
that	O
invoke	O
OS	O
behaviors	O
may	O
be	O
viewed	O
as	O
interactions	O
with	O
a	O
runtime	B-Device
system	I-Device
.	O
</s>
<s>
In	O
the	O
limit	O
,	O
the	O
runtime	B-Device
system	I-Device
may	O
provide	O
services	O
such	O
as	O
a	O
P-code	B-Language
machine	I-Language
or	O
virtual	B-Architecture
machine	I-Architecture
,	O
that	O
hide	O
even	O
the	O
processor	O
's	O
instruction	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
This	O
is	O
the	O
approach	O
followed	O
by	O
many	O
interpreted	B-Application
languages	I-Application
such	O
as	O
AWK	B-Application
,	O
and	O
some	O
languages	O
like	O
Java	B-Language
,	O
which	O
are	O
meant	O
to	O
be	O
compiled	B-Language
into	O
some	O
machine-independent	O
intermediate	B-Application
representation	I-Application
code	O
(	O
such	O
as	O
bytecode	O
)	O
.	O
</s>
<s>
This	O
arrangement	O
simplifies	O
the	O
task	O
of	O
language	O
implementation	O
and	O
its	O
adaptation	O
to	O
different	O
machines	O
,	O
and	O
improves	O
efficiency	O
of	O
sophisticated	O
language	O
features	O
such	O
as	O
reflection	B-Language
.	O
</s>
<s>
To	O
speed	O
up	O
execution	O
,	O
some	O
runtime	B-Device
systems	I-Device
feature	O
just-in-time	O
compilation	B-Language
to	O
machine	O
code	O
.	O
</s>
<s>
A	O
modern	O
aspect	O
of	O
runtime	B-Device
systems	I-Device
is	O
parallel	O
execution	O
behaviors	O
,	O
such	O
as	O
the	O
behaviors	O
exhibited	O
by	O
mutex	O
constructs	O
in	O
Pthreads	B-Operating_System
and	O
parallel	O
section	O
constructs	O
in	O
OpenMP	B-Application
.	O
</s>
<s>
A	O
runtime	B-Device
system	I-Device
with	O
such	O
parallel	O
execution	O
behaviors	O
may	O
be	O
modularized	O
according	O
to	O
the	O
proto-runtime	O
approach	O
.	O
</s>
<s>
Notable	O
early	O
examples	O
of	O
runtime	B-Device
systems	I-Device
are	O
the	O
interpreters	B-Application
for	O
BASIC	O
and	O
Lisp	B-Language
.	O
</s>
<s>
These	O
environments	O
also	O
included	O
a	O
garbage	B-General_Concept
collector	I-General_Concept
.	O
</s>
<s>
Forth	B-Application
is	O
an	O
early	O
example	O
of	O
a	O
language	O
designed	O
to	O
be	O
compiled	B-Language
into	O
intermediate	B-Application
representation	I-Application
code	O
;	O
its	O
runtime	B-Device
system	I-Device
was	O
a	O
virtual	B-Architecture
machine	I-Architecture
that	O
interpreted	O
that	O
code	O
.	O
</s>
<s>
In	O
C	B-Language
and	O
later	O
languages	O
that	O
supported	O
dynamic	B-General_Concept
memory	I-General_Concept
allocation	I-General_Concept
,	O
the	O
runtime	B-Device
system	I-Device
also	O
included	O
a	O
library	O
that	O
managed	O
the	O
program	O
's	O
memory	B-General_Concept
pool	O
.	O
</s>
<s>
In	O
the	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
,	O
the	O
runtime	B-Device
system	I-Device
was	O
often	O
also	O
responsible	O
for	O
dynamic	B-Language
type	O
checking	O
and	O
resolving	O
method	O
references	O
.	O
</s>
