<s>
Operating	B-General_Concept
systems	I-General_Concept
use	O
lock	O
managers	O
to	O
organise	O
and	O
serialise	O
the	O
access	O
to	O
resources	O
.	O
</s>
<s>
A	O
distributed	B-Operating_System
lock	I-Operating_System
manager	I-Operating_System
(	O
DLM	O
)	O
runs	O
in	O
every	O
machine	O
in	O
a	O
cluster	B-Architecture
,	O
with	O
an	O
identical	O
copy	O
of	O
a	O
cluster-wide	O
lock	O
database	O
.	O
</s>
<s>
In	O
this	O
way	O
a	O
DLM	O
provides	O
software	B-Application
applications	I-Application
which	O
are	O
distributed	B-Architecture
across	O
a	O
cluster	B-Architecture
on	O
multiple	O
machines	O
with	O
a	O
means	O
to	O
synchronize	O
their	O
accesses	O
to	O
shared	B-General_Concept
resources	I-General_Concept
.	O
</s>
<s>
DLMs	O
have	O
been	O
used	O
as	O
the	O
foundation	O
for	O
several	O
successful	O
clustered	B-Application
file	I-Application
systems	I-Application
,	O
in	O
which	O
the	O
machines	O
in	O
a	O
cluster	B-Architecture
can	O
use	O
each	O
other	O
's	O
storage	O
via	O
a	O
unified	O
file	B-Application
system	I-Application
,	O
with	O
significant	O
advantages	O
for	O
performance	O
and	O
availability	B-General_Concept
.	O
</s>
<s>
The	O
main	O
performance	O
benefit	O
comes	O
from	O
solving	O
the	O
problem	O
of	O
disk	B-General_Concept
cache	I-General_Concept
coherency	I-General_Concept
between	O
participating	O
computers	O
.	O
</s>
<s>
The	O
DLM	O
is	O
used	O
not	O
only	O
for	O
file	B-Application
locking	I-Application
but	O
also	O
for	O
coordination	O
of	O
all	O
disk	B-Device
access	O
.	O
</s>
<s>
VMScluster	B-Operating_System
,	O
the	O
first	O
clustering	O
system	O
to	O
come	O
into	O
widespread	O
use	O
,	O
relied	O
on	O
the	O
OpenVMS	B-Operating_System
DLM	O
in	O
just	O
this	O
way	O
.	O
</s>
<s>
The	O
DLM	O
uses	O
a	O
generalized	O
concept	O
of	O
a	O
resource	O
,	O
which	O
is	O
some	O
entity	O
to	O
which	O
shared	B-General_Concept
access	I-General_Concept
must	O
be	O
controlled	O
.	O
</s>
<s>
This	O
can	O
relate	O
to	O
a	O
file	O
,	O
a	O
record	O
,	O
an	O
area	O
of	O
shared	O
memory	O
,	O
or	O
anything	O
else	O
that	O
the	O
application	B-Application
designer	O
chooses	O
.	O
</s>
<s>
A	O
process	B-Operating_System
can	O
then	O
acquire	O
locks	O
on	O
the	O
database	O
as	O
a	O
whole	O
,	O
and	O
then	O
on	O
particular	O
parts	O
of	O
the	O
database	O
.	O
</s>
<s>
A	O
process	B-Operating_System
running	O
within	O
a	O
VMSCluster	B-Operating_System
may	O
obtain	O
a	O
lock	O
on	O
a	O
resource	O
.	O
</s>
<s>
A	O
process	B-Operating_System
can	O
obtain	O
a	O
lock	O
on	O
a	O
resource	O
by	O
enqueueing	O
a	O
lock	O
request	O
.	O
</s>
<s>
This	O
is	O
similar	O
to	O
the	O
QIO	B-Operating_System
technique	O
that	O
is	O
used	O
to	O
perform	O
I/O	O
.	O
</s>
<s>
The	O
enqueue	O
lock	O
request	O
can	O
either	O
complete	O
synchronously	O
,	O
in	O
which	O
case	O
the	O
process	B-Operating_System
waits	O
until	O
the	O
lock	O
is	O
granted	O
,	O
or	O
asynchronously	O
,	O
in	O
which	O
case	O
an	O
AST	B-Operating_System
occurs	O
when	O
the	O
lock	O
has	O
been	O
obtained	O
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
establish	O
a	O
blocking	O
AST	B-Operating_System
,	O
which	O
is	O
triggered	O
when	O
a	O
process	B-Operating_System
has	O
obtained	O
a	O
lock	O
that	O
is	O
preventing	O
access	O
to	O
the	O
resource	O
by	O
another	O
process	B-Operating_System
.	O
</s>
<s>
The	O
original	O
process	B-Operating_System
can	O
then	O
optionally	O
take	O
action	O
to	O
allow	O
the	O
other	O
access	O
(	O
e.g.	O
</s>
<s>
This	O
can	O
be	O
read	O
by	O
any	O
process	B-Operating_System
that	O
has	O
obtained	O
a	O
lock	O
on	O
the	O
resource	O
(	O
other	O
than	O
a	O
null	O
lock	O
)	O
and	O
can	O
be	O
updated	O
by	O
a	O
process	B-Operating_System
that	O
has	O
obtained	O
a	O
protected	O
update	O
or	O
exclusive	O
lock	O
on	O
it	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
to	O
hold	O
any	O
information	O
about	O
the	O
resource	O
that	O
the	O
application	B-Application
designer	O
chooses	O
.	O
</s>
<s>
When	O
another	O
process	B-Operating_System
wishes	O
to	O
read	O
the	O
resource	O
,	O
it	O
obtains	O
the	O
appropriate	O
lock	O
and	O
compares	O
the	O
current	O
lock	O
value	O
with	O
the	O
value	O
it	O
had	O
last	O
time	O
the	O
process	B-Operating_System
locked	O
the	O
resource	O
.	O
</s>
<s>
If	O
the	O
value	O
is	O
the	O
same	O
,	O
the	O
process	B-Operating_System
knows	O
that	O
the	O
associated	O
entity	O
has	O
not	O
been	O
updated	O
since	O
last	O
time	O
it	O
read	O
it	O
,	O
and	O
therefore	O
it	O
is	O
unnecessary	O
to	O
read	O
it	O
again	O
.	O
</s>
<s>
Hence	O
,	O
this	O
technique	O
can	O
be	O
used	O
to	O
implement	O
various	O
types	O
of	O
cache	B-General_Concept
in	O
a	O
database	O
or	O
similar	O
application	B-Application
.	O
</s>
<s>
This	O
is	O
known	O
as	O
a	O
deadlock	B-Operating_System
(	O
E	O
.	O
W	O
.	O
Dijkstra	O
originally	O
called	O
it	O
a	O
deadly	B-Operating_System
embrace	I-Operating_System
)	O
.	O
</s>
<s>
A	O
simple	O
example	O
is	O
when	O
Process	B-Operating_System
1	O
has	O
obtained	O
an	O
exclusive	O
lock	O
on	O
Resource	O
A	O
,	O
and	O
Process	B-Operating_System
2	O
has	O
obtained	O
an	O
exclusive	O
lock	O
on	O
Resource	O
B	O
.	O
</s>
<s>
If	O
Process	B-Operating_System
1	O
then	O
tries	O
to	O
lock	O
Resource	O
B	O
,	O
it	O
will	O
have	O
to	O
wait	O
for	O
Process	B-Operating_System
2	O
to	O
release	O
it	O
.	O
</s>
<s>
But	O
if	O
Process	B-Operating_System
2	O
then	O
tries	O
to	O
lock	O
Resource	O
A	O
,	O
both	O
processes	O
will	O
wait	O
forever	O
for	O
each	O
other	O
.	O
</s>
<s>
The	O
OpenVMS	B-Operating_System
DLM	O
periodically	O
checks	O
for	O
deadlock	B-Operating_System
situations	O
.	O
</s>
<s>
In	O
the	O
example	O
above	O
,	O
the	O
second	O
lock	O
enqueue	O
request	O
of	O
one	O
of	O
the	O
processes	O
would	O
return	O
with	O
a	O
deadlock	B-Operating_System
status	O
.	O
</s>
<s>
It	O
would	O
then	O
be	O
up	O
to	O
this	O
process	B-Operating_System
to	O
take	O
action	O
to	O
resolve	O
the	O
deadlock	B-Operating_System
—	O
in	O
this	O
case	O
by	O
releasing	O
the	O
first	O
lock	O
it	O
obtained	O
.	O
</s>
<s>
Both	O
Red	O
Hat	O
and	O
Oracle	B-Application
have	O
developed	O
clustering	O
software	O
for	O
Linux	B-Operating_System
.	O
</s>
<s>
OCFS2	B-Application
,	O
the	O
Oracle	B-Application
Cluster	I-Application
File	I-Application
System	I-Application
was	O
added	O
to	O
the	O
official	O
Linux	B-Operating_System
kernel	I-Operating_System
with	O
version	O
2.6.16	O
,	O
in	O
January	O
2006	O
.	O
</s>
<s>
The	O
alpha-quality	O
code	O
warning	O
on	O
OCFS2	B-Application
was	O
removed	O
in	O
2.6.19	O
.	O
</s>
<s>
Red	O
Hat	O
's	O
cluster	B-Architecture
software	O
,	O
including	O
their	O
DLM	O
and	O
GFS2	B-Application
was	O
officially	O
added	O
to	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
with	O
version	O
2.6.19	O
,	O
in	O
November	O
2006	O
.	O
</s>
<s>
Both	O
systems	O
use	O
a	O
DLM	O
modeled	O
on	O
the	O
venerable	O
VMS	B-Operating_System
DLM	O
.	O
</s>
<s>
Oracle	B-Application
's	O
DLM	O
has	O
a	O
simpler	O
API	O
.	O
</s>
<s>
(	O
the	O
core	O
function	O
,	O
dlmlock( )	O
,	O
has	O
eight	O
parameters	O
,	O
whereas	O
the	O
VMS	B-Operating_System
SYS$ENQ	O
service	O
and	O
Red	O
Hat	O
's	O
dlm_lock	O
both	O
have	O
11	O
.	O
)	O
</s>
<s>
Google	B-Application
has	O
developed	O
Chubby	B-Operating_System
,	O
a	O
lock	O
service	O
for	O
loosely	O
coupled	O
distributed	B-Architecture
systems	I-Architecture
.	O
</s>
<s>
It	O
is	O
designed	O
for	O
coarse-grained	O
locking	O
and	O
also	O
provides	O
a	O
limited	O
but	O
reliable	O
distributed	B-Architecture
file	B-Application
system	I-Application
.	O
</s>
<s>
Key	O
parts	O
of	O
Google	B-Application
's	I-Application
infrastructure	O
,	O
including	O
Google	B-Application
File	I-Application
System	I-Application
,	O
Bigtable	B-Application
,	O
and	O
MapReduce	B-Operating_System
,	O
use	O
Chubby	B-Operating_System
to	O
synchronize	O
accesses	O
to	O
shared	B-General_Concept
resources	I-General_Concept
.	O
</s>
<s>
Though	O
Chubby	B-Operating_System
was	O
designed	O
as	O
a	O
lock	O
service	O
,	O
it	O
is	O
now	O
heavily	O
used	O
inside	O
Google	B-Application
as	O
a	O
name	B-Protocol
server	I-Protocol
,	O
supplanting	O
DNS	B-Protocol
.	O
</s>
<s>
Apache	B-Language
ZooKeeper	I-Language
,	O
which	O
was	O
created	O
at	O
Yahoo	B-Application
,	O
is	O
open-source	O
software	O
and	O
can	O
be	O
used	O
to	O
perform	O
distributed	B-Architecture
locks	O
as	O
well	O
.	O
</s>
<s>
Etcd	O
is	O
open-source	O
software	O
,	O
developed	O
at	O
CoreOS	B-Application
under	O
the	O
Apache	O
License	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
to	O
perform	O
distributed	B-Architecture
locks	O
as	O
well	O
.	O
</s>
<s>
Redis	B-Operating_System
is	O
an	O
open	O
source	O
,	O
BSD	O
licensed	O
,	O
advanced	O
key-value	O
cache	B-General_Concept
and	O
store	O
.	O
</s>
<s>
Redis	B-Operating_System
can	O
be	O
used	O
to	O
implement	O
the	O
Redlock	O
Algorithm	O
for	O
distributed	B-Architecture
lock	O
management	O
.	O
</s>
<s>
HashiCorp	O
's	O
Consul	B-Application
,	O
which	O
was	O
created	O
by	O
HashiCorp	O
,	O
is	O
open-source	O
software	O
and	O
can	O
be	O
used	O
to	O
perform	O
distributed	B-Architecture
locks	O
as	O
well	O
.	O
</s>
<s>
Taooka	O
distributed	B-Operating_System
lock	I-Operating_System
manager	I-Operating_System
uses	O
the	O
"	O
try	O
lock	O
"	O
methods	O
to	O
avoid	O
deadlocks	B-Operating_System
.	O
</s>
<s>
A	O
DLM	O
is	O
also	O
a	O
key	O
component	O
of	O
more	O
ambitious	O
single	B-Operating_System
system	I-Operating_System
image	I-Operating_System
(	O
SSI	O
)	O
projects	O
such	O
as	O
OpenSSI	B-Operating_System
.	O
</s>
