<s>
In	O
databases	B-Application
and	O
transaction	B-General_Concept
processing	I-General_Concept
,	O
two-phase	O
locking	B-Operating_System
(	O
2PL	O
)	O
is	O
a	O
concurrency	B-Operating_System
control	I-Operating_System
method	O
that	O
guarantees	O
serializability	B-Operating_System
.	O
</s>
<s>
It	O
is	O
also	O
the	O
name	O
of	O
the	O
resulting	O
set	O
of	O
database	B-General_Concept
transaction	I-General_Concept
schedules	O
(	O
histories	O
)	O
.	O
</s>
<s>
The	O
protocol	O
uses	O
locks	B-Operating_System
,	O
applied	O
by	O
a	O
transaction	O
to	O
data	O
,	O
which	O
may	O
block	O
(	O
interpreted	O
as	O
signals	O
to	O
stop	O
)	O
other	O
transactions	O
from	O
accessing	O
the	O
same	O
data	O
during	O
the	O
transaction	O
's	O
life	O
.	O
</s>
<s>
By	O
the	O
2PL	O
protocol	O
,	O
locks	B-Operating_System
are	O
applied	O
and	O
removed	O
in	O
two	O
phases	O
:	O
</s>
<s>
Expanding	O
phase	O
:	O
locks	B-Operating_System
are	O
acquired	O
and	O
no	O
locks	B-Operating_System
are	O
released	O
.	O
</s>
<s>
Shrinking	O
phase	O
:	O
locks	B-Operating_System
are	O
released	O
and	O
no	O
locks	B-Operating_System
are	O
acquired	O
.	O
</s>
<s>
Two	O
types	O
of	O
locks	B-Operating_System
are	O
used	O
by	O
the	O
basic	O
protocol	O
:	O
Shared	O
and	O
Exclusive	O
locks	B-Operating_System
.	O
</s>
<s>
Refinements	O
of	O
the	O
basic	O
protocol	O
may	O
use	O
more	O
lock	B-Operating_System
types	O
.	O
</s>
<s>
Using	O
locks	B-Operating_System
that	O
block	O
processes	O
,	O
2PL	O
may	O
be	O
subject	O
to	O
deadlocks	B-Operating_System
that	O
result	O
from	O
the	O
mutual	O
blocking	O
of	O
two	O
or	O
more	O
transactions	O
.	O
</s>
<s>
A	O
lock	B-Operating_System
is	O
a	O
system	O
object	O
associated	O
with	O
a	O
shared	O
resource	O
such	O
as	O
a	O
data	O
item	O
of	O
an	O
elementary	O
type	O
,	O
a	O
row	O
in	O
a	O
database	O
,	O
or	O
a	O
page	O
of	O
memory	O
.	O
</s>
<s>
In	O
a	O
database	O
,	O
a	O
lock	B-Operating_System
on	O
a	O
database	O
object	O
(	O
a	O
data-access	O
lock	B-Operating_System
)	O
may	O
need	O
to	O
be	O
acquired	O
by	O
a	O
transaction	O
before	O
accessing	O
the	O
object	O
.	O
</s>
<s>
Correct	O
use	O
of	O
locks	B-Operating_System
prevents	O
undesired	O
,	O
incorrect	O
or	O
inconsistent	O
operations	O
on	O
shared	O
resources	O
by	O
other	O
concurrent	O
transactions	O
.	O
</s>
<s>
When	O
a	O
database	O
object	O
with	O
an	O
existing	O
lock	B-Operating_System
acquired	O
by	O
one	O
transaction	O
needs	O
to	O
be	O
accessed	O
by	O
another	O
transaction	O
,	O
the	O
existing	O
lock	B-Operating_System
for	O
the	O
object	O
and	O
the	O
type	O
of	O
the	O
intended	O
access	O
are	O
checked	O
by	O
the	O
system	O
.	O
</s>
<s>
If	O
the	O
existing	O
lock	B-Operating_System
type	O
does	O
not	O
allow	O
this	O
specific	O
attempted	O
concurrent	B-Operating_System
access	I-Operating_System
type	O
,	O
the	O
transaction	O
attempting	O
access	O
is	O
blocked	O
(	O
according	O
to	O
a	O
predefined	O
agreement/scheme	O
)	O
.	O
</s>
<s>
In	O
practice	O
,	O
a	O
lock	B-Operating_System
on	O
an	O
object	O
does	O
not	O
directly	O
block	O
a	O
transaction	O
's	O
operation	O
upon	O
the	O
object	O
,	O
but	O
rather	O
blocks	O
that	O
transaction	O
from	O
acquiring	O
another	O
lock	B-Operating_System
on	O
the	O
same	O
object	O
,	O
needed	O
to	O
be	O
held/owned	O
by	O
the	O
transaction	O
before	O
performing	O
this	O
operation	O
.	O
</s>
<s>
Thus	O
,	O
with	O
a	O
locking	B-Operating_System
mechanism	O
,	O
needed	O
operation	O
blocking	O
is	O
controlled	O
by	O
a	O
proper	O
lock	B-Operating_System
blocking	O
scheme	O
,	O
which	O
indicates	O
which	O
lock	B-Operating_System
type	O
blocks	O
which	O
lock	B-Operating_System
type	O
.	O
</s>
<s>
Two	O
major	O
types	O
of	O
locks	B-Operating_System
are	O
used	O
:	O
</s>
<s>
Write-lock	O
(	O
exclusive	O
lock	B-Operating_System
)	O
is	O
associated	O
with	O
a	O
database	O
object	O
by	O
a	O
transaction	O
(	O
Terminology	O
:	O
"	O
the	O
transaction	O
locks	B-Operating_System
the	O
object	O
,	O
"	O
or	O
"	O
acquires	O
lock	B-Operating_System
for	O
it	O
"	O
)	O
before	O
writing	O
(	O
inserting/modifying/deleting	O
)	O
this	O
object	O
.	O
</s>
<s>
Read-lock	O
(	O
shared	O
lock	B-Operating_System
)	O
is	O
associated	O
with	O
a	O
database	O
object	O
by	O
a	O
transaction	O
before	O
reading	O
(	O
retrieving	O
the	O
state	O
of	O
)	O
this	O
object	O
.	O
</s>
<s>
The	O
common	O
interactions	O
between	O
these	O
lock	B-Operating_System
types	O
are	O
defined	O
by	O
blocking	O
behavior	O
as	O
follows	O
:	O
</s>
<s>
An	O
existing	O
write-lock	O
on	O
a	O
database	O
object	O
blocks	O
an	O
intended	O
write	O
upon	O
the	O
same	O
object	O
(	O
already	O
requested/issued	O
)	O
by	O
another	O
transaction	O
by	O
blocking	O
a	O
respective	O
write-lock	O
from	O
being	O
acquired	O
by	O
the	O
other	O
transaction	O
.	O
</s>
<s>
The	O
second	O
write-lock	O
will	O
be	O
acquired	O
and	O
the	O
requested	O
write	O
of	O
the	O
object	O
will	O
take	O
place	O
(	O
materialize	O
)	O
after	O
the	O
existing	O
write-lock	O
is	O
released	O
.	O
</s>
<s>
A	O
write-lock	O
blocks	O
an	O
intended	O
(	O
already	O
requested/issued	O
)	O
read	O
by	O
another	O
transaction	O
by	O
blocking	O
the	O
respective	O
read-lock	O
.	O
</s>
<s>
A	O
read-lock	O
blocks	O
an	O
intended	O
write	O
by	O
another	O
transaction	O
by	O
blocking	O
the	O
respective	O
write-lock	O
.	O
</s>
<s>
A	O
read-lock	O
does	O
not	O
block	O
an	O
intended	O
read	O
by	O
another	O
transaction	O
.	O
</s>
<s>
The	O
respective	O
read-lock	O
for	O
the	O
intended	O
read	O
is	O
acquired	O
(	O
shared	O
with	O
the	O
previous	O
read	O
)	O
immediately	O
after	O
the	O
intended	O
read	O
is	O
requested	O
,	O
and	O
then	O
the	O
intended	O
read	O
itself	O
takes	O
place	O
.	O
</s>
<s>
Several	O
variations	O
and	O
refinements	O
of	O
these	O
major	O
lock	B-Operating_System
types	O
exist	O
,	O
with	O
respective	O
variations	O
of	O
blocking	O
behavior	O
.	O
</s>
<s>
If	O
a	O
first	O
lock	B-Operating_System
blocks	O
another	O
lock	B-Operating_System
,	O
the	O
two	O
locks	B-Operating_System
are	O
called	O
incompatible	O
;	O
otherwise	O
the	O
locks	B-Operating_System
are	O
compatible	O
.	O
</s>
<s>
Often	O
,	O
lock	B-Operating_System
types	O
blocking	O
interactions	O
are	O
presented	O
in	O
the	O
technical	O
literature	O
by	O
a	O
Lock	B-Operating_System
compatibility	O
table	O
.	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
with	O
the	O
common	O
,	O
major	O
lock	B-Operating_System
types	O
:	O
</s>
<s>
Lock	B-Operating_System
type	O
!	O
</s>
<s>
read-lock	O
!	O
</s>
<s>
X	O
indicates	O
incompatibility	O
,	O
i.e	O
,	O
a	O
case	O
when	O
a	O
lock	B-Operating_System
of	O
the	O
first	O
type	O
(	O
in	O
left	O
column	O
)	O
on	O
an	O
object	O
blocks	O
a	O
lock	B-Operating_System
of	O
the	O
second	O
type	O
(	O
in	O
top	O
row	O
)	O
from	O
being	O
acquired	O
on	O
the	O
same	O
object	O
(	O
by	O
another	O
transaction	O
)	O
.	O
</s>
<s>
An	O
object	O
typically	O
has	O
a	O
queue	O
of	O
waiting	O
requested	O
(	O
by	O
transactions	O
)	O
operations	O
with	O
respective	O
locks	B-Operating_System
.	O
</s>
<s>
The	O
first	O
blocked	O
lock	B-Operating_System
for	O
operation	O
in	O
the	O
queue	O
is	O
acquired	O
as	O
soon	O
as	O
the	O
existing	O
blocking	O
lock	B-Operating_System
is	O
removed	O
from	O
the	O
object	O
,	O
and	O
then	O
its	O
respective	O
operation	O
is	O
executed	O
.	O
</s>
<s>
If	O
a	O
lock	B-Operating_System
for	O
operation	O
in	O
the	O
queue	O
is	O
not	O
blocked	O
by	O
any	O
existing	O
lock	B-Operating_System
(	O
existence	O
of	O
multiple	O
compatible	O
locks	B-Operating_System
on	O
a	O
same	O
object	O
is	O
possible	O
concurrently	O
)	O
,	O
it	O
is	O
acquired	O
immediately	O
.	O
</s>
<s>
According	O
to	O
the	O
two-phase	O
locking	B-Operating_System
protocol	O
,	O
a	O
transaction	O
handles	O
its	O
locks	B-Operating_System
in	O
two	O
distinct	O
,	O
consecutive	O
phases	O
during	O
the	O
transaction	O
's	O
execution	O
:	O
</s>
<s>
Expanding	O
phase	O
(	O
aka	O
Growing	O
phase	O
)	O
:	O
locks	B-Operating_System
are	O
acquired	O
and	O
no	O
locks	B-Operating_System
are	O
released	O
(	O
the	O
number	O
of	O
locks	B-Operating_System
can	O
only	O
increase	O
)	O
.	O
</s>
<s>
Shrinking	O
phase	O
(	O
aka	O
Contracting	O
phase	O
)	O
:	O
locks	B-Operating_System
are	O
released	O
and	O
no	O
locks	B-Operating_System
are	O
acquired	O
.	O
</s>
<s>
The	O
two	O
phase	O
locking	B-Operating_System
rules	O
can	O
be	O
summarized	O
as	O
:	O
never	O
acquire	O
a	O
lock	B-Operating_System
after	O
a	O
lock	B-Operating_System
has	O
been	O
released	O
.	O
</s>
<s>
The	O
serializability	B-Operating_System
property	O
is	O
guaranteed	O
for	O
a	O
schedule	B-General_Concept
with	O
transactions	O
that	O
obey	O
this	O
rule	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
all	O
the	O
locks	B-Operating_System
can	O
be	O
released	O
at	O
once	O
(	O
phase	O
2	O
)	O
.	O
</s>
<s>
The	O
difference	O
between	O
2PL	O
and	O
C2PL	B-Operating_System
is	O
that	O
C2PL	B-Operating_System
's	O
transactions	O
obtain	O
all	O
the	O
locks	B-Operating_System
they	O
need	O
before	O
the	O
transactions	O
begin	O
.	O
</s>
<s>
This	O
is	O
to	O
ensure	O
that	O
a	O
transaction	O
that	O
already	O
holds	O
some	O
locks	B-Operating_System
will	O
not	O
block	O
waiting	O
for	O
other	O
locks	B-Operating_System
.	O
</s>
<s>
Conservative	O
2PL	O
prevents	O
deadlocks	B-Operating_System
.	O
</s>
<s>
To	O
comply	O
with	O
the	O
S2PL	O
protocol	O
,	O
a	O
transaction	O
needs	O
to	O
comply	O
with	O
2PL	O
,	O
and	O
release	O
its	O
write	O
(	O
exclusive	O
)	O
locks	B-Operating_System
only	O
after	O
it	O
has	O
ended	O
,	O
i.e.	O
,	O
being	O
either	O
committed	O
or	O
aborted	O
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
read	O
(	O
shared	O
)	O
locks	B-Operating_System
are	O
released	O
regularly	O
during	O
phase	O
2	O
.	O
</s>
<s>
To	O
comply	O
with	O
strong	B-Operating_System
strict	I-Operating_System
two-phase	I-Operating_System
locking	I-Operating_System
(	O
SS2PL	O
)	O
the	O
locking	B-Operating_System
protocol	O
releases	O
both	O
write	O
(	O
exclusive	O
)	O
and	O
read	O
(	O
shared	O
)	O
locks	B-Operating_System
applied	O
by	O
a	O
transaction	O
only	O
after	O
the	O
transaction	O
has	O
ended	O
,	O
i.e.	O
,	O
only	O
after	O
both	O
completing	O
executing	O
(	O
being	O
ready	O
)	O
and	O
becoming	O
either	O
committed	O
or	O
aborted	O
.	O
</s>
<s>
The	O
SS2PL	O
property	O
of	O
a	O
schedule	B-General_Concept
is	O
also	O
called	O
Rigorousness	O
.	O
</s>
<s>
It	O
is	O
also	O
the	O
name	O
of	O
the	O
class	O
of	O
schedules	O
having	O
this	O
property	O
,	O
and	O
an	O
SS2PL	O
schedule	B-General_Concept
is	O
also	O
called	O
a	O
"	O
rigorous	O
schedule	B-General_Concept
"	O
.	O
</s>
<s>
The	O
term	O
"	O
Rigorousness	O
"	O
is	O
free	O
of	O
the	O
unnecessary	O
legacy	O
of	O
"	O
two-phase	O
,	O
"	O
as	O
well	O
as	O
being	O
independent	O
of	O
any	O
(	O
locking	B-Operating_System
)	O
mechanism	O
(	O
in	O
principle	O
other	O
blocking	O
mechanisms	O
can	O
be	O
used	O
)	O
.	O
</s>
<s>
The	O
property	O
's	O
respective	O
locking	B-Operating_System
mechanism	O
is	O
sometimes	O
referred	O
to	O
as	O
Rigorous	O
2PL	O
.	O
</s>
<s>
SS2PL	O
is	O
a	O
special	O
case	O
of	O
S2PL	O
,	O
i.e.	O
,	O
the	O
SS2PL	O
class	O
of	O
schedules	O
is	O
a	O
proper	O
subclass	O
of	O
S2PL	O
(	O
every	O
SS2PL	O
schedule	B-General_Concept
is	O
also	O
an	O
S2PL	O
schedule	B-General_Concept
,	O
but	O
S2PL	O
schedules	O
exist	O
that	O
are	O
not	O
SS2PL	O
)	O
.	O
</s>
<s>
SS2PL	O
has	O
been	O
the	O
concurrency	B-Operating_System
control	I-Operating_System
protocol	O
of	O
choice	O
for	O
most	O
database	B-Application
systems	I-Application
and	O
used	O
since	O
their	O
early	O
days	O
in	O
the	O
1970s	O
.	O
</s>
<s>
It	O
is	O
proven	O
to	O
be	O
an	O
effective	O
mechanism	O
in	O
many	O
situations	O
,	O
and	O
provides	O
besides	O
Serializability	B-Operating_System
also	O
Strictness	O
(	O
a	O
special	O
case	O
of	O
cascadeless	O
Recoverability	O
)	O
,	O
which	O
is	O
instrumental	O
for	O
efficient	O
database	O
recovery	B-Application
,	O
and	O
also	O
Commitment	B-Architecture
ordering	I-Architecture
(	O
CO	O
)	O
for	O
participating	O
in	O
distributed	O
environments	O
where	O
a	O
CO	O
based	O
distributed	B-Operating_System
serializability	I-Operating_System
and	O
global	B-Operating_System
serializability	I-Operating_System
solutions	O
are	O
employed	O
.	O
</s>
<s>
Being	O
a	O
subset	O
of	O
CO	O
,	O
an	O
efficient	O
implementation	O
of	O
distributed	O
SS2PL	O
exists	O
without	O
a	O
distributed	B-Operating_System
lock	I-Operating_System
manager	I-Operating_System
(	O
DLM	O
)	O
,	O
while	O
distributed	O
deadlocks	B-Operating_System
(	O
see	O
below	O
)	O
are	O
resolved	O
automatically	O
.	O
</s>
<s>
The	O
fact	O
that	O
SS2PL	O
employed	O
in	O
multi	O
database	B-Application
systems	I-Application
ensures	O
global	B-Operating_System
serializability	I-Operating_System
has	O
been	O
known	O
for	O
years	O
before	O
the	O
discovery	O
of	O
CO	O
,	O
but	O
only	O
with	O
CO	O
came	O
the	O
understanding	O
of	O
the	O
role	O
of	O
an	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
in	O
maintaining	O
global	B-Operating_System
serializability	I-Operating_System
,	O
as	O
well	O
as	O
the	O
observation	O
of	O
automatic	O
distributed	O
deadlock	B-Operating_System
resolution	O
(	O
see	O
a	O
detailed	O
example	O
of	O
Distributed	O
SS2PL	O
)	O
.	O
</s>
<s>
As	O
a	O
matter	O
of	O
fact	O
,	O
SS2PL	O
inheriting	O
properties	O
of	O
Recoverability	O
and	O
CO	O
is	O
more	O
significant	O
than	O
being	O
a	O
subset	O
of	O
2PL	O
,	O
which	O
by	O
itself	O
in	O
its	O
general	O
form	O
,	O
besides	O
comprising	O
a	O
simple	O
serializability	B-Operating_System
mechanism	O
(	O
however	O
serializability	B-Operating_System
is	O
also	O
implied	O
by	O
CO	O
)	O
,	O
is	O
not	O
known	O
to	O
provide	O
SS2PL	O
with	O
any	O
other	O
significant	O
qualities	O
.	O
</s>
<s>
Also	O
,	O
unlike	O
the	O
general	O
2PL	O
,	O
SS2PL	O
provides	O
,	O
as	O
mentioned	O
above	O
,	O
the	O
useful	O
Strictness	O
and	O
Commitment	B-Architecture
ordering	I-Architecture
properties	O
.	O
</s>
<s>
Many	O
variants	O
of	O
SS2PL	O
exist	O
that	O
use	O
various	O
lock	B-Operating_System
types	O
with	O
various	O
semantics	O
in	O
different	O
situations	O
,	O
including	O
cases	O
of	O
lock-type	O
change	O
during	O
a	O
transaction	O
.	O
</s>
<s>
Notable	O
are	O
variants	O
that	O
use	O
Multiple	B-Operating_System
granularity	I-Operating_System
locking	I-Operating_System
.	O
</s>
<s>
SS2PL	O
vs.	O
S2PL	O
:	O
Both	O
provide	O
Serializability	B-Operating_System
and	O
Strictness	O
.	O
</s>
<s>
However	O
,	O
no	O
concurrency	O
advantage	O
is	O
typically	O
practically	O
noticed	O
(	O
exactly	O
same	O
locking	B-Operating_System
exists	O
for	O
both	O
,	O
with	O
practically	O
not	O
much	O
earlier	O
lock	B-Operating_System
release	O
for	O
S2PL	O
)	O
,	O
and	O
the	O
overhead	O
of	O
dealing	O
with	O
an	O
end-of-phase-1	O
mechanism	O
in	O
S2PL	O
,	O
separate	O
from	O
transaction	O
end	O
,	O
is	O
not	O
justified	O
.	O
</s>
<s>
Also	O
,	O
while	O
SS2PL	O
provides	O
Commitment	B-Architecture
ordering	I-Architecture
,	O
S2PL	O
does	O
not	O
.	O
</s>
<s>
1987	O
,	O
p.59	O
)	O
,	O
the	O
term	O
"	O
Strict	O
2PL	O
"	O
(	O
S2PL	O
)	O
has	O
been	O
frequently	O
defined	O
by	O
the	O
locking	B-Operating_System
protocol	O
"	O
Release	O
all	O
locks	B-Operating_System
only	O
after	O
transaction	O
end	O
,	O
"	O
which	O
is	O
the	O
protocol	O
of	O
SS2PL	O
.	O
</s>
<s>
A	O
more	O
general	O
property	O
than	O
SS2PL	O
exists	O
(	O
a	O
schedule	B-General_Concept
super-class	O
)	O
,	O
Strict	O
commitment	B-Architecture
ordering	I-Architecture
(	O
Strict	O
CO	O
,	O
or	O
SCO	O
)	O
,	O
which	O
as	O
well	O
provides	O
both	O
serializability	B-Operating_System
,	O
strictness	O
,	O
and	O
CO	O
,	O
and	O
has	O
similar	O
locking	B-Operating_System
overhead	O
.	O
</s>
<s>
Unlike	O
SS2PL	O
,	O
SCO	O
does	O
not	O
block	O
upon	O
a	O
read-write	O
conflict	O
(	O
a	O
read	O
lock	B-Operating_System
does	O
not	O
block	O
acquiring	O
a	O
write	O
lock	B-Operating_System
;	O
both	O
SCO	O
and	O
SS2PL	O
have	O
the	O
same	O
behavior	O
for	O
write-read	O
and	O
write-write	O
conflicts	O
)	O
at	O
the	O
cost	O
of	O
a	O
possible	O
delayed	O
commit	O
,	O
and	O
upon	O
such	O
conflict	O
type	O
SCO	O
has	O
shorter	O
average	O
transaction	O
completion	O
time	O
and	O
better	O
performance	O
than	O
SS2PL	O
.	O
</s>
<s>
While	O
SS2PL	O
obeys	O
the	O
lock	B-Operating_System
compatibility	O
table	O
above	O
,	O
SCO	O
has	O
the	O
following	O
table	O
:	O
</s>
<s>
Lock	B-Operating_System
type	O
!	O
</s>
<s>
read-lock	O
!	O
</s>
<s>
Note	O
that	O
though	O
SCO	O
releases	O
all	O
locks	B-Operating_System
at	O
transaction	O
end	O
and	O
complies	O
with	O
the	O
2PL	O
locking	B-Operating_System
rules	O
,	O
SCO	O
is	O
not	O
a	O
subset	O
of	O
2PL	O
because	O
of	O
its	O
different	O
lock	B-Operating_System
compatibility	O
table	O
.	O
</s>
<s>
SCO	O
allows	O
materialized	O
read-write	O
conflicts	O
between	O
two	O
transactions	O
in	O
their	O
phases	O
1	O
,	O
which	O
2PL	O
does	O
not	O
allow	O
in	O
phase	O
1	O
(	O
see	O
about	O
materialized	O
conflicts	O
in	O
Serializability	B-Operating_System
)	O
.	O
</s>
<s>
Together	O
this	O
implies	O
that	O
the	O
schedule	B-General_Concept
classes	O
2PL	O
and	O
SCO	O
are	O
incomparable	O
(	O
i.e.	O
,	O
no	O
class	O
contains	O
the	O
other	O
class	O
)	O
.	O
</s>
<s>
Between	O
any	O
two	O
schedule	B-General_Concept
classes	O
(	O
define	O
by	O
their	O
schedules	O
 '	O
respective	O
properties	O
)	O
that	O
have	O
common	O
schedules	O
,	O
either	O
one	O
contains	O
the	O
other	O
(	O
strictly	O
contains	O
if	O
they	O
are	O
not	O
equal	O
)	O
,	O
or	O
they	O
are	O
incomparable	O
.	O
</s>
<s>
The	O
containment	O
relationships	O
among	O
the	O
2PL	O
classes	O
and	O
other	O
major	O
schedule	B-General_Concept
classes	O
are	O
summarized	O
in	O
the	O
following	O
diagram	O
.	O
</s>
<s>
Locks	B-Operating_System
block	O
data-access	O
operations	O
.	O
</s>
<s>
Mutual	O
blocking	O
between	O
transactions	O
results	O
in	O
a	O
deadlock	B-Operating_System
,	O
where	O
execution	O
of	O
these	O
transactions	O
is	O
stalled	O
,	O
and	O
no	O
completion	O
can	O
be	O
reached	O
.	O
</s>
<s>
Thus	O
deadlocks	B-Operating_System
need	O
to	O
be	O
resolved	O
to	O
complete	O
these	O
transactions	O
 '	O
executions	O
and	O
release	O
related	O
computing	O
resources	O
.	O
</s>
<s>
A	O
deadlock	B-Operating_System
is	O
a	O
reflection	O
of	O
a	O
potential	O
cycle	O
in	O
the	O
precedence	O
graph	O
,	O
that	O
would	O
occur	O
without	O
the	O
blocking	O
.	O
</s>
<s>
A	O
deadlock	B-Operating_System
is	O
resolved	O
by	O
aborting	O
a	O
transaction	O
involved	O
with	O
such	O
potential	O
cycle	O
,	O
and	O
breaking	O
the	O
cycle	O
.	O
</s>
<s>
It	O
is	O
often	O
detected	O
using	O
a	O
wait-for	B-Operating_System
graph	I-Operating_System
(	O
a	O
graph	O
of	O
conflicts	O
blocked	O
by	O
locks	B-Operating_System
from	O
being	O
materialized	O
;	O
conflicts	O
not	O
materialized	O
in	O
the	O
database	O
due	O
to	O
blocked	O
operations	O
are	O
not	O
reflected	O
in	O
the	O
precedence	O
graph	O
and	O
do	O
not	O
affect	O
serializability	B-Operating_System
)	O
,	O
which	O
indicates	O
which	O
transaction	O
is	O
"	O
waiting	O
for	O
"	O
lock	B-Operating_System
release	O
by	O
which	O
transaction	O
,	O
and	O
a	O
cycle	O
means	O
a	O
deadlock	B-Operating_System
.	O
</s>
<s>
If	O
a	O
transaction	O
has	O
been	O
aborted	O
due	O
to	O
deadlock	B-Operating_System
resolution	O
,	O
it	O
is	O
up	O
to	O
the	O
application	O
to	O
decide	O
what	O
to	O
do	O
next	O
.	O
</s>
<s>
Usually	O
,	O
an	O
application	O
will	O
restart	O
the	O
transaction	O
from	O
the	O
beginning	O
but	O
may	O
delay	O
this	O
action	O
to	O
give	O
other	O
transactions	O
sufficient	O
time	O
to	O
finish	O
in	O
order	O
to	O
avoid	O
causing	O
another	O
deadlock	B-Operating_System
.	O
</s>
<s>
In	O
a	O
distributed	O
environment	O
an	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
,	O
typically	O
the	O
Two-phase	B-General_Concept
commit	I-General_Concept
(	O
2PC	B-General_Concept
)	O
protocol	O
,	O
is	O
used	O
for	O
atomicity	B-General_Concept
.	O
</s>
<s>
When	O
recoverable	O
data	O
(	O
data	O
under	O
transaction	O
control	O
)	O
partitioned	O
among	O
2PC	B-General_Concept
participants	O
(	O
i.e.	O
,	O
each	O
data	O
object	O
is	O
controlled	O
by	O
a	O
single	O
2PC	B-General_Concept
participant	O
)	O
,	O
then	O
distributed	O
(	O
global	O
)	O
deadlocks	B-Operating_System
,	O
deadlocks	B-Operating_System
involving	O
two	O
or	O
more	O
participants	O
in	O
2PC	B-General_Concept
,	O
are	O
resolved	O
automatically	O
as	O
follows	O
:	O
</s>
<s>
When	O
SS2PL	O
is	O
effectively	O
used	O
in	O
a	O
distributed	O
environment	O
,	O
then	O
global	O
deadlocks	B-Operating_System
due	O
to	O
locking	B-Operating_System
generate	O
voting-deadlocks	O
in	O
2PC	B-General_Concept
,	O
and	O
are	O
resolved	O
automatically	O
by	O
2PC	B-General_Concept
(	O
see	O
Commitment	B-Architecture
ordering	I-Architecture
(	O
CO	O
)	O
,	O
in	O
Exact	O
characterization	O
of	O
voting-deadlocks	O
by	O
global	O
cycles	O
;	O
No	O
reference	O
except	O
the	O
CO	O
articles	O
is	O
known	O
to	O
notice	O
this	O
)	O
.	O
</s>
<s>
For	O
the	O
general	O
case	O
of	O
2PL	O
,	O
global	O
deadlocks	B-Operating_System
are	O
similarly	O
resolved	O
automatically	O
by	O
the	O
synchronization	O
point	O
protocol	O
of	O
phase-1	O
end	O
in	O
a	O
distributed	O
transaction	O
(	O
synchronization	O
point	O
is	O
achieved	O
by	O
"	O
voting	O
"	O
(	O
notifying	O
local	O
phase-1	O
end	O
)	O
,	O
and	O
being	O
propagated	O
to	O
the	O
participants	O
in	O
a	O
distributed	O
transaction	O
the	O
same	O
way	O
as	O
a	O
decision	O
point	O
in	O
atomic	B-Operating_System
commitment	I-Operating_System
;	O
in	O
analogy	O
to	O
decision	O
point	O
in	O
CO	O
,	O
a	O
conflicting	O
operation	O
in	O
2PL	O
cannot	O
happen	O
before	O
phase-1	O
end	O
synchronization	O
point	O
,	O
with	O
the	O
same	O
resulting	O
voting-deadlock	O
in	O
the	O
case	O
of	O
a	O
global	O
data-access	O
deadlock	B-Operating_System
;	O
the	O
voting-deadlock	O
(	O
which	O
is	O
also	O
a	O
locking	B-Operating_System
based	O
global	O
deadlock	B-Operating_System
)	O
is	O
automatically	O
resolved	O
by	O
the	O
protocol	O
aborting	O
some	O
transaction	O
involved	O
,	O
with	O
a	O
missing	O
vote	O
,	O
typically	O
using	O
a	O
timeout	O
)	O
.	O
</s>
<s>
When	O
data	O
are	O
partitioned	O
among	O
the	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
(	O
e.g.	O
,	O
2PC	B-General_Concept
)	O
participants	O
,	O
automatic	O
global	O
deadlock	B-Operating_System
resolution	O
has	O
been	O
overlooked	O
in	O
the	O
database	O
research	O
literature	O
,	O
though	O
deadlocks	B-Operating_System
in	O
such	O
systems	O
has	O
been	O
a	O
quite	O
intensive	O
research	O
area	O
:	O
</s>
<s>
For	O
CO	O
and	O
its	O
special	O
case	O
SS2PL	O
,	O
the	O
automatic	O
resolution	O
by	O
the	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
has	O
been	O
noticed	O
only	O
in	O
the	O
CO	O
articles	O
.	O
</s>
<s>
However	O
,	O
it	O
has	O
been	O
noticed	O
in	O
practice	O
that	O
in	O
many	O
cases	O
global	O
deadlocks	B-Operating_System
are	O
very	O
infrequently	O
detected	O
by	O
the	O
dedicated	O
resolution	O
mechanisms	O
,	O
less	O
than	O
could	O
be	O
expected	O
(	O
"	O
Why	O
do	O
we	O
see	O
so	O
few	O
global	O
deadlocks	B-Operating_System
?	O
"	O
)	O
.	O
</s>
<s>
The	O
reason	O
is	O
probably	O
the	O
deadlocks	B-Operating_System
that	O
are	O
automatically	O
resolved	O
and	O
thus	O
not	O
handled	O
and	O
uncounted	O
by	O
the	O
mechanisms	O
;	O
</s>
<s>
For	O
2PL	O
in	O
general	O
,	O
the	O
automatic	O
resolution	O
by	O
the	O
(	O
mandatory	O
)	O
end-of-phase-one	O
synchronization	O
point	O
protocol	O
(	O
which	O
has	O
same	O
voting	O
mechanism	O
as	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
,	O
and	O
same	O
missing	O
vote	O
handling	O
upon	O
voting	O
deadlock	B-Operating_System
,	O
resulting	O
in	O
global	O
deadlock	B-Operating_System
resolution	O
)	O
has	O
not	O
been	O
mentioned	O
until	O
today	O
(	O
2009	O
)	O
.	O
</s>
<s>
Practically	O
only	O
the	O
special	O
case	O
SS2PL	O
is	O
used	O
,	O
where	O
no	O
end-of-phase-one	O
synchronization	O
is	O
needed	O
in	O
addition	O
to	O
atomic	B-Operating_System
commit	I-Operating_System
protocol	O
.	O
</s>
<s>
In	O
a	O
distributed	O
environment	O
where	O
recoverable	O
data	O
are	O
not	O
partitioned	O
among	O
atomic	B-Operating_System
commitment	I-Operating_System
protocol	O
participants	O
,	O
no	O
such	O
automatic	O
resolution	O
exists	O
,	O
and	O
distributed	O
deadlocks	B-Operating_System
need	O
to	O
be	O
resolved	O
by	O
dedicated	O
techniques	O
.	O
</s>
