Running Consis en Applica ions Close o Use s wi h
Radical o Lowe La ency
1 Consis ency P oo
1.1 De ini ions
He e we show ha Radical p o ides linea izabili y gua an-
ees o i s use s. Linea izabili y is a local consis ency model,
hus o p o e ha a sys em is linea izable, i is su icien o
show ha ope a ions on each indi idual key a e linea izable
[
1
]. Wi hou loss o gene ali y, conside key
π
. Radical sup-
po s wo ope a ions: eads (
π(ππ£)
deno ing ha a ead o
key
π
e u ns i s alue e sion
π£
) and w i es (
π€(ππ£)
deno -
ing a w i e o
π
o alue e sion
π£
). Linea izabili y equi es
ha he e exis s a o al o de o ope a ions on
π
which we
cons uc as ollows:
1.
Each w i e is o de ed by i s e sion numbe :
π€(ππ£)ππ₯π
βββ
π€(ππ£+π),π >0.
2.
Each ead is o de ed a e he w i e ha i obse es:
π€(ππ£)ππ₯π
βββ
π(ππ£)
3.
All eads ha obse e he same w i e a e o de ed by in-
oca ion ime:
π1(ππ£)ππ₯π
βββ ... ππ₯π
βββ ππ(ππ£)
i
π1.πππ£ <... <
ππ.πππ£
Fo he sys em o be linea izable, his o al o de mus also
obey eal- ime o de ing cons ain s.
1.2 P oo
Thus o show ha Radical is linea izable, we mus show
ha Radical espec s he abo e-cons uc ed o al o de un-
de eal- ime cons ain s. Fi s , le all ope a ion be illus-
a ed as a di ec ed g aph whe e he ope a ions a e nodes
ha a e connec ed by eal- ime edges. Then we can say
ha he e exis s a o al eal- ime o de i and only i he
di ec ed g aph is acyclic (ope a ions do no ci cula ly a -
ec each o he ), meaning ha he ollowing in a ian holds:
βπππ, πππ,(πππ
ππ‘π
βββ πππ)=β Β¬(πππ
ππ‘π
βββ πππ).
No e ha he e exis s a eal- ime edge
ππ1
ππ‘π
βββ ππ2
i
ππ2
sees he esul o
ππ1
and
ππ2
s a s a e
ππ1
ends (
ππ1.πππ π <
ππ2.πππ£
). No e ha his implies ha ope a ions a e ansi i e.
Tha is i
ππ1
ππ‘π
βββ ππ2
and
ππ2
ππ‘π
βββ ππ3
, hen
ππ1
ππ‘π
βββ ππ3
.
Two ope a ions ha e a eal- ime edge in one o wo cases:
1. ππ1
and
ππ2
a e pe o med sequen ially by he same unc-
ion execu ion whe e ππ1p ecedes ππ2
2. ππ1
and
ππ2
a e pe o med by wo di e en execu ions,
and ππ2sees he esul o ππ1 ia Radicalβs design
We p o e ha Radicalβs o al o de is a eal- ime o de by
con adic ion. Mo e speci ically, we conside pai s o ope a-
ions (π€,π€),(π,π),(π, π€),(π€, π).
1. (π€,π€)
:le he e be wo w i es such ha
π€1=π€(ππ£)ππ₯π
βββ
π€2=π€(ππ£β²), π£β²>π£
. By he con adic ion we assume we
also ha e
π€2
ππ‘π
βββ π€1
. Because
π€2
is eal- ime o de ed be-
o e ano he ope a ion, we know
π€2
mus ha e comple ed.
The e a e wo cases:
a. π€2
comple ed a he edge. Then i mus ha e acqui ed
a w i e lock as pa o i s success ul consis ency check
(lines XXβYY). This lock p ecludes any o he ope a ion
om acqui ing a w i e lock (lines XXβYY) un il i is
eleased. The e a e h ee subcases depending on how
π€1execu es:
i. π€1
comple es a he edge. Then i mus also ac-
qui e a w i e lock as pa o i s success ul consis-
ency check. Since
π€2
ππ‘π
βββ π€1
, hen
π€2.π€πππ‘π_ππππ <
π€2.πππ π <π€1.πππ£ <π€1.π€πππ‘π_ππππ
, so we know
ha
π€1
mus acqui e i s lock a e
π€2
eleases i s
lock. Ve sion numbe s only inc ease o subse-
quen w i es (lines XXβYY), so
π£β²
(w i en by
π€2
)
<π£(w i en by π€1). Con adic ion.
ii. π€1
comple es in he da acen e . Then i mus also
acqui e a w i e lock as pa o i s ailed consis-
ency check.
π€2
mus ha e eleased he locks be-
o e
π€1
could s a unning a he da acen e , so
i
π€2
ππ‘π
βββ π€1
, hen
π€2.π€πππ‘π_ππππ <π€2.πππ π <
π€1.πππ£ <π€1.π€πππ‘π_ππππ
, simila ly o he case
when
π€1
comple es in he edge. Ve sion numbe s
only inc ease o subsequen w i es, so
π£β²<π£
.
Con adic ion.
iii. π€2
comple es a he da acen e o a he edge as
pa o a imeou . I
π€2
s a ed unning a he
edge, hen i mus ha e acqui ed a w i e lock as
pa o i s consis ency check. I he da acen e
imes ou on he ollow-up om he edge, he
w i e lock is s ill held, and he execu ion is e un
in he da acen e . Thus, depending on whe he
he ollow-up om he edge inally a i es o
he unc ion on he da acen e inishes execu ing
i s , he same logic om cases (i) and (ii) applies.
I he unc ion inished execu ing i s , he la e
s ale ollow-up is disca ded, and i he ollow-up
a i es du ing da acen e execu ion, he esul o
he da acen e execu ion is igno ed.
b. π€2
comple es in he da acen e . Then i mus ha e
acqui ed a w i e lock as pa o i s ailed consis ency
check (lines XX-YY). No o he ope a ions, whe he
in he da acen e o a he edge, could be pe o ming
ope a ions on
π
un il
π€2
comple es. The e a e wo
1
subcases depending on whe e
π€1
execu es (we omi
he imeou case as he easoning is simila o wha is
desc ibed in 1(a)iii):
i. π€1
comple es a he edge. Then i mus ha e been
he case ha
π€1
acqui ed he w i e lock as pa
o i s success ul consis ency check. This neces-
si a es ha
π€2
eleased i s lock i s . I
π€2
ππ‘π
βββ
π€1
, hen
π€2.π€πππ‘π_ππππ <π€2.πππ π <π€1.πππ£ <
π€1.π€πππ‘π_ππππ
. Ve sion numbe s only inc ease o
subsequen w i es, so π£β²<π£. Con adic ion.
ii. π€1
comple es a he da acen e . Then i mus ha e
wai ed o
π€2
o elease i s lock be o e acqui ing
he lock as pa o i s ailed consis ency check.
Thus,
π€2
and
π€1
execu e a he da acen e se-
quen ially, in ha o de . As in he abo e case,
π€2
ππ‘π
βββ π€1=βπ€2.π€πππ‘π_ππππ <π€2.πππ π <
π€1.πππ£ <π€1.π€πππ‘π_ππππ
, and since e sion num-
be s only inc ease o subsequen w i es, so
π£β²<π£
.
Con adic ion.
2. (π,π)
:le he e be wo eads such ha
π1
ππ₯π
βββ π2
. By he
con adic ion we assume we also ha e
π2
ππ‘π
βββ π1
. Because
π2
is eal- ime o de ed be o e ano he ope a ion, we know
π2mus ha e comple ed. The e a e wo cases:
a.
I
π1=π(ππ£)
and
π2=π(ππ£)
e u n he same alues,
hen he wo eads a e o de ed by in oca ion ime.
Since
π1.πππ£ <π2.πππ£
, he e canno be a eal- ime edge
om π2 o π1. Con adic ion.
b.
I
π1=π(ππ£)
and
π2=π(ππ£β²)
whe e
π£β²>π£
and
π1
ππ₯π
βββ
π2
, hen he e mus exis
π€1
ha
π1
sees and
π€2
ha
π2
sees, such ha
π€2
is o de ed a e
π€1
. In o he wo ds,
i mus be he case ha
π€1
ππ₯π
βββ π1
,
π€2
ππ₯π
βββ π2
, and
π€1
ππ₯π
βββ π€2
. Assuming he e exis s he edge
π2
ππ‘π
βββ π1
,
hen we know ha
π2
mus ha e comple ed. The e a e
wo cases:
i.
I
π2
comple ed a he edge, i mus be he case
ha he ead lock on
π
was acqui ed and he
consis ency check was success ul. Thus, he e
could ha e been no w i es o
π
be ween
π2.πππ£
and
π2.ππππ_ππππ
. The e a e wo subcases depending
on whe e π1execu es:
A. π1
also comple es a he edge. Then i mus
ha e also acqui ed a ead lock on
π
o en-
su e all pending w i es we e comple e. How-
e e ,
π1
would ha e acqui ed he ead lock
a e
π€1
execu ed. Since
π€1
should ha e ac-
qui ed a w i e lock be o e
π1
, i is necessa y
ha
π€1
execu ed be ween
π2.ππππ_π’πππππ
and
π1.ππππ_ππππ
. In o he wo ds, he ollowing
mus be ue:
π2.πππ£ <π2.ππππ_ππππ <π€1.π€πππ‘π_ππππ <
π1.ππππ_ππππ
. Since
π2.πππ π <π1.πππ£
by as-
sump ion (
π2
ππ‘π
βββ π1
) and
π€2.π€πππ‘π_ππππ <
π2.ππππ_ππππ
(
π€2
ππ₯π
βββ π2
), hen ansi i ely,
i mus be ue ha
π€2
ππ‘π
βββ π1
. Since eads
mus be o de ed a e he w i es hey obse e,
π€1
mus occu be ween
π€2
and
π1
. Howe e ,
w i es a e o de ed in inc easing e sion num-
be in he o al o de , and since
π€2=π€(ππ£β²),π€1=
π€(ππ£), π£β²>π£, his is a con adic ion.
B. π1
comple es a he da acen e . Then i mus
ha e acqui ed a ead lock on
π
o a oid ead-
ing s ale da a. Simila ly,
π€1
mus ha e ac-
qui ed he w i e lock a some poin be o e
π1
acqui ed i s ead lock. Simila o he abo e, we
necessa ily expec ha
π2.πππ£ <π2.ππππ_ππππ <
π€1.π€πππ‘π_ππππ <π1.ππππ_ππππ
and
π€2.π€πππ‘π_ππππ <
π2.ππππ_ππππ
. Thus
π€2
ππ‘π
βββ π1=βπ€2
ππ₯π
βββ
π€1
ππ₯π
βββ π1
which iola es legal o de ing o
w i es by e sion numbe . Con adic ion.
ii.
I
π2
comple ed a he da acen e , hen he ead
lock on
π
was acqui ed as pa o a ailed consis-
ency check. No execu ions ha w i e o
π
a e pos-
sible (whe he a da acen e o on edge) once he
ead lock is acqui ed. As desc ibed abo e, ega d-
less o whe e
π1
execu es,
π€1
mus ha e ob ained a
w i e lock be o ehand such ha
π€2.π€πππ‘π_ππππ <
π2.ππππ_ππππ <π€1.π€πππ‘π_ππππ <π1.ππππ_ππππ
.
Consequen ly,
π€2
ππ‘π
βββ π1
,
π€2
ππ₯π
βββ π€1
ππ₯π
βββ π1
which is ou o o de w i es. Con adic ion.
3. (π,π€)
:le he e be a ead and a w i e such ha
π=π(ππ£)ππ₯π
βββ
π€β²=π€(ππ£β²), π£β²>π£
. By he con adic ion we also ha e
π€β²ππ‘π
βββ π
. Because
π€β²
is eal- ime o de ed be o e ano he
ope a ion, we know
π€β²
mus ha e comple ed. The e a e
wo cases:
a. π€β²
comple es a he edge. Then i mus ha e acqui ed
a w i e lock on
π
be o e
π
execu ed. Whe he
π
was
execu ed on edge o in da acen e , i held he ead
lock and sen a esponse back o he use be o e
π€β²
ook i s w i e lock. In o he wo ds, since
π€β²ππ‘π
βββ π
,
hen
π€β².π€πππ‘π_ππππ <π€β².πππ π <π.πππ£ <π.ππππ_ππππ
.
Howe e ,
π
would e u n he alue o
π
o e sion
π£
,
no
π£β²
. Thus he e mus exis a w i e
π€=π€(ππ£)
ha
is o de ed be ween
π€β²
and
π
such ha
π€β²ππ₯π
βββ π€π
ββ
,
which a e ou -o -o de w i es. Con adic ion.
b. π€β²
comple ed a he da acen e . Then i mus ha e ac-
qui ed a w i e lock as pa o i s ailed consis ency
check. Then
π€
, by he same logic as abo e, ei he
execu es in da acen e o on edge, a e
π€β²
eleased
i s lock, so i
π€β²ππ‘π
βββ π
, he ope a ions mus be o -
de ed as
π€β²ππ₯π
βββ π€π
ββ
, gua an eed by
π€β².π€πππ‘π_ππππ <
π€.π€πππ‘π_ππππ <π.ππππ_ππππ
, which a e ou -o -o de
w i es. Con adic ion.
2
4. (π€, π)
:le he e be a w i e and a ead ha obse es ha
w i e such ha
π€=π€(ππ£)ππ₯π
βββ π=π(ππ£)
. By he con-
adic ion we also ha e
πππ‘π
βββ π€
. Because
π
is eal- ime
o de ed be o e ano he ope a ion, we know
π
mus ha e
comple ed. The e a e wo cases:
a. π
comple es a he edge. Then i mus ha e acqui ed a
ead lock on
π
. The e a e hen wo subcases on whe e
π€is execu ed:
i.
I
π€
is execu ed on he edge, hen i acqui ed he
w i e lock and necessa ily a e
π
eleased i s ead
lock. Thus
π
mus ha e ead some da a be o e
π€
execu ed. Since
π
ead
ππ£
be o e
ππ£
was w i en by
π€
, he ead is no o de ed by he w i e i obse es.
Con adic ion.
ii.
I
π€
execu ed in he da acen e , hen simila ly
π.πππ£ <π.ππππ_ππππ <π.πππ π <π€.πππ£ <π€.π€πππ‘π_ππππ
which means ha he ead is no o de ed a e
he w i e i obse es. Con adic ion.
b. π
comple es a he da acen e as a esul o a ailed
consis ency check. I does so a e acqui ing a ead lock
such ha all pending w i es comple e i s . Conside
whe e π€is execu ed a e wa ds:
i.
I
π€
is execu ed a he edge, hen
π€
acqui ed
a w i e lock as pa o a success ul consis ency
check, he eby equi ing ha
π.ππππ_ππππ <π€.π€πππ‘π_ππππ
.
The w i e lock is only eleased upon cen al da as-
o e upda e as a esul o he ollow up om edge.
Thus i
πππ‘π
βββ π€
, hen he ead would obse e a
w i e ha did no ye occu . Con adic ion.
ii.
I and when
π€
is execu ed a he da acen e , hen
π
mus ha e al eady eleased i s ead lock. In o he
wo ds,
π
and
π€
a e execu ed sequen ially a he
da acen e , so he ead would no be o de ed a e
he w i e i obse es. Con adic ion.
Thus, he o de ing obeys he eal- ime o de o all pai s
o ope a ions on each key
π
. Because ou gi en o de ing is
a legal o al o de ha obeys eal- ime cons ain s, Radical
p o ides linea izabili y.
Re e ences
[1]
Mau ice P He lihy and Jeanne e M Wing. Linea izabili y: A co ec ness
condi ion o concu en objec s. ACM T ansac ions on P og amming
Languages and Sys ems (TOPLAS), 12(3):463β492, 1990.
3