<s>
A	O
global	B-Operating_System
interpreter	I-Operating_System
lock	I-Operating_System
(	O
GIL	O
)	O
is	O
a	O
mechanism	O
used	O
in	O
computer-language	O
interpreters	B-Application
to	O
synchronize	O
the	O
execution	O
of	O
threads	B-Operating_System
so	O
that	O
only	O
one	O
native	O
thread	B-Operating_System
(	O
per	O
process	B-Operating_System
)	O
can	O
execute	O
at	O
a	O
time	O
.	O
</s>
<s>
An	O
interpreter	B-Application
that	O
uses	O
GIL	O
always	O
allows	O
exactly	O
one	O
thread	B-Operating_System
to	O
execute	O
at	O
a	O
time	O
,	O
even	O
if	O
run	O
on	O
a	O
multi-core	B-Architecture
processor	I-Architecture
.	O
</s>
<s>
Some	O
popular	O
interpreters	B-Application
that	O
have	O
GIL	O
are	O
CPython	B-Language
and	O
Ruby	B-Language
MRI	I-Language
.	O
</s>
<s>
A	O
global	B-Operating_System
interpreter	I-Operating_System
lock	I-Operating_System
(	O
GIL	O
)	O
is	O
a	O
mutual-exclusion	B-Operating_System
lock	B-Operating_System
held	O
by	O
a	O
programming	O
language	O
interpreter	B-Application
thread	B-Operating_System
to	O
avoid	O
sharing	O
code	O
that	O
is	O
not	O
thread-safe	B-Operating_System
with	O
other	O
threads	B-Operating_System
.	O
</s>
<s>
In	O
implementations	O
with	O
a	O
GIL	O
,	O
there	O
is	O
always	O
one	O
GIL	O
for	O
each	O
interpreter	B-Application
process	B-Operating_System
.	O
</s>
<s>
Applications	O
running	O
on	O
implementations	O
with	O
a	O
GIL	O
can	O
be	O
designed	O
to	O
use	O
separate	O
processes	O
to	O
achieve	O
full	O
parallelism	B-Operating_System
,	O
as	O
each	O
process	B-Operating_System
has	O
its	O
own	O
interpreter	B-Application
and	O
in	O
turn	O
has	O
its	O
own	O
GIL	O
.	O
</s>
<s>
Otherwise	O
,	O
the	O
GIL	O
can	O
be	O
a	O
significant	O
barrier	O
to	O
parallelism	B-Operating_System
.	O
</s>
<s>
Reasons	O
for	O
employing	O
a	O
global	B-Operating_System
interpreter	I-Operating_System
lock	I-Operating_System
include	O
:	O
</s>
<s>
increased	O
speed	O
of	O
single-threaded	B-Operating_System
programs	O
(	O
no	O
necessity	O
to	O
acquire	O
or	O
release	O
locks	O
on	O
all	O
data	O
structures	O
separately	O
)	O
,	O
</s>
<s>
easy	O
integration	O
of	O
C	B-Language
libraries	O
that	O
usually	O
are	O
not	O
thread-safe	B-Operating_System
,	O
</s>
<s>
ease	O
of	O
implementation	O
(	O
having	O
a	O
single	O
GIL	O
is	O
much	O
simpler	O
to	O
implement	O
than	O
a	O
lock-free	O
interpreter	B-Application
or	O
one	O
using	O
fine-grained	O
locks	O
)	O
.	O
</s>
<s>
A	O
way	O
to	O
get	O
around	O
a	O
GIL	O
is	O
creating	O
a	O
separate	O
interpreter	B-Application
per	O
thread	B-Operating_System
,	O
which	O
is	O
too	O
expensive	O
with	O
most	O
languages	O
.	O
</s>
<s>
Use	O
of	O
a	O
global	B-Operating_System
interpreter	I-Operating_System
lock	I-Operating_System
in	O
a	O
language	O
effectively	O
limits	O
the	O
amount	O
of	O
parallelism	B-Operating_System
reachable	O
through	O
concurrency	B-Operating_System
of	O
a	O
single	O
interpreter	B-Application
process	B-Operating_System
with	O
multiple	O
threads	B-Operating_System
.	O
</s>
<s>
If	O
the	O
process	B-Operating_System
is	O
almost	O
purely	O
made	O
up	O
of	O
interpreted	O
code	O
and	O
does	O
not	O
make	O
calls	O
outside	O
of	O
the	O
interpreter	B-Application
which	O
block	O
for	O
long	O
periods	O
of	O
time	O
(	O
allowing	O
the	O
GIL	O
to	O
be	O
released	O
by	O
that	O
thread	B-Operating_System
while	O
they	O
process	B-Operating_System
)	O
,	O
there	O
is	O
likely	O
to	O
be	O
very	O
little	O
increase	O
in	O
speed	O
when	O
running	O
the	O
process	B-Operating_System
on	O
a	O
multiprocessor	B-Operating_System
machine	O
.	O
</s>
<s>
Due	O
to	O
signaling	O
with	O
a	O
CPU-bound	O
thread	B-Operating_System
,	O
it	O
can	O
cause	O
a	O
significant	O
slowdown	O
,	O
even	O
on	O
single	O
processors	O
.	O
</s>
<s>
More	O
seriously	O
,	O
when	O
the	O
single	O
native	O
thread	B-Operating_System
calls	O
a	O
blocking	O
OS	O
process	B-Operating_System
(	O
such	O
as	O
disk	O
access	O
)	O
,	O
the	O
entire	O
process	B-Operating_System
is	O
blocked	O
,	O
even	O
though	O
other	O
application	O
threads	B-Operating_System
may	O
be	O
waiting	O
.	O
</s>
<s>
Some	O
language	O
implementations	O
that	O
implement	O
a	O
global	B-Operating_System
interpreter	I-Operating_System
lock	I-Operating_System
are	O
CPython	B-Language
,	O
the	O
most	O
widely-used	O
implementation	O
of	O
Python	B-Language
,	O
and	O
Ruby	B-Language
MRI	I-Language
,	O
the	O
reference	O
implementation	O
of	O
Ruby	B-Language
(	O
where	O
it	O
is	O
called	O
Global	O
VM	O
Lock	B-Operating_System
)	O
.	O
</s>
<s>
JVM-based	O
equivalents	O
of	O
these	O
languages	O
(	O
Jython	B-Language
and	O
JRuby	B-Language
)	O
do	O
not	O
use	O
global	B-Operating_System
interpreter	I-Operating_System
locks	I-Operating_System
.	O
</s>
<s>
IronPython	B-Application
and	O
IronRuby	B-Language
are	O
implemented	O
on	O
top	O
of	O
Microsoft	O
's	O
Dynamic	B-Application
Language	I-Application
Runtime	I-Application
and	O
also	O
avoid	O
using	O
a	O
GIL	O
.	O
</s>
<s>
An	O
example	O
of	O
an	O
interpreted	B-Application
language	I-Application
without	O
a	O
GIL	O
is	O
Tcl	B-Operating_System
,	O
which	O
is	O
used	O
in	O
the	O
benchmarking	O
tool	O
HammerDB	B-Application
.	O
</s>
