Communicating State Transition Systems for Fine-Grained Concurrent Resources
Aleksandar Nanevski Ruy Ley-Wild Ilya Sergey Germán Delbianco
HOPE 2013
Communicating State Transition Systems for Fine-Grained Concurrent - - PowerPoint PPT Presentation
Communicating State Transition Systems for Fine-Grained Concurrent Resources Aleksandar Nanevski Ruy Ley-Wild Ilya Sergey Germn Delbianco HOPE 2013 Reasoning about shared-memory concurrency How to model shared-memory
Aleksandar Nanevski Ruy Ley-Wild Ilya Sergey Germán Delbianco
HOPE 2013
O'Hearn [CONCUR'07], Brookes [CONCUR'04] Jones [TOPLAS'83]
Conditional Critical Regions with Resource Invariants
Conditional Critical Regions with Resource Invariants
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
“resource creation”
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
Γ ` {p1} c1 {q1} Γ ` {p2} c2 {q2} Γ ` {p1 ⇤ p2} c1 k c2 {q1 ⇤ q2}
PARCSL
Γ ` {p1} c1 {q1} Γ ` {p2} c2 {q2} Γ ` {p1 ⇤ p2} c1 k c2 {q1 ⇤ q2}
PARCSL
All interference is handled here
for process interference via Guarantee relation.
for process interference via Guarantee relation.
Atomic operations should be given specifications stable wrt Rely relation.
R _ G2,G1 ` {p} c1 {q1} R _ G1,G2 ` {p} c2 {q2} R,G1 _ G2 ` {p} c1 k c2 {q1 ^ q2}
PARRG
} { _ G2 ` { R,G1
R _ G2,G1 ` {p} c1 {q1} R _ G1,G2 ` {p} c2 {q2} R,G1 _ G2 ` {p} c1 k c2 {q1 ^ q2}
PARRG
} { _ G2 ` { R,G1
R _ G2,G1 ` {p} c1 {q1} R _ G1,G2 ` {p} c2 {q2} R,G1 _ G2 ` {p} c1 k c2 {q1 ^ q2}
PARRG
} { _ G2 ` { R,G1
(Ley-Wild and Nanevski, POPL 2013)
| {z }
Self
| {z } | {z }
Self Other
| {z } |
{z } | {z }
Self Other Shared
| {z } |
{z } | {z }
Self Other Shared
| {z } |
{z } | {z }
Self Other Shared
| {z } |
{z } | {z }
Self Other Shared
| {z } |
{z } | {z }
Self Other Shared
a Partial Commutative Monoid (PCM): (S, 0, ⊕).
n1
n2 n1
n2 n1 n1 ≤ n < n2
n2 n1 n1 ≤ n < n2
n2 n1 n1 ≤ n < n2
next
lock = { x := DRAW; while (!TRY(x)) SKIP; } unlock = { INCR_OWN; } DRAW = { return FETCH_AND_INCREMENT(next); } TRY(n) = { return (n == owner); } INCR_OWN = { owner := owner + 1; }
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
s = ∧
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
ts ⊕ to = {n | n1 ≤ n < n2} ∧ s = ∧
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
ts ⊕ to = {n | n1 ≤ n < n2} ∧
s = ∧
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
ts ⊕ to = {n | n1 ≤ n < n2} ∧
∨
Locked
s = ∧
(n1 ∈ (ts ⊕ to) ∧ b = true ∧ h = emp)
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
ts ⊕ to = {n | n1 ≤ n < n2} ∧
∨
if n1 < n2 then n1 ∈ (ts ⊕ to) ∧ b = false ∧ I(as ⊕ ao)h else n1 = n2 ∧ b = false ∧ I(as ⊕ ao)h
Locked
s = ∧
(n1 ∈ (ts ⊕ to) ∧ b = true ∧ h = emp)
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
ts ⊕ to = {n | n1 ≤ n < n2} ∧
∨
if n1 < n2 then n1 ∈ (ts ⊕ to) ∧ b = false ∧ I(as ⊕ ao)h else n1 = n2 ∧ b = false ∧ I(as ⊕ ao)h
Locked Unlocked
s = ∧
(n1 ∈ (ts ⊕ to) ∧ b = true ∧ h = emp)
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
ts ⊕ to = {n | n1 ≤ n < n2} ∧
∨
if n1 < n2 then n1 ∈ (ts ⊕ to) ∧ b = false ∧ I(as ⊕ ao)h else n1 = n2 ∧ b = false ∧ I(as ⊕ ao)h
Locked Unlocked Transit
s = ∧
(n1 ∈ (ts ⊕ to) ∧ b = true ∧ h = emp)
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
All dispensed tickets
Intuition: drawing a ticket from the dispenser
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
Intuition: drawing a ticket from the dispenser
(ao, to) ` ⇣
hbi
h
∗ ∗
next 7! n2 + 1
(as, ts ∪ {n2})
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
Intuition: drawing a ticket from the dispenser
int
(ao, to) ` ⇣
hbi
h
∗ ∗
next 7! n2 + 1
(as, ts ∪ {n2})
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
Intuition: drawing a ticket from the dispenser
int
(ao, to) ` ⇣
hbi
h
∗ ∗
next 7! n2 + 1
(as, ts ∪ {n2})
(as, ts) (ao, to)
next 7! n2 ∗ ∗
` ⇣
h
hbi
Intuition: drawing a ticket from the dispenser
int
Channels with different polarity
Channels with different polarity
Acquire/Release transitions
(communication is via heap ownership transfer)
Intuition: the lock obtains back ownership over the heap and increments the service counter (owner)
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
∗ ∗
` ⇣
h
hfalsei
next 7! n2
(as, ts)
Intuition: the lock obtains back ownership over the heap and increments the service counter (owner)
acqh
1
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
∗ ∗
` ⇣
h
hfalsei
next 7! n2
(as, ts)
Intuition: the lock obtains back ownership over the heap and increments the service counter (owner)
acqh
1
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
∗ ∗
` ⇣
h
hfalsei
next 7! n2
(as, ts)
Intuition: the lock obtains back ownership over the heap and increments the service counter (owner)
acqh
1
Intuition: the lock gave up ownership over the heap
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
hfalsei
Intuition: the lock gave up ownership over the heap
relh
1
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
hfalsei
Intuition: the lock gave up ownership over the heap
relh
1
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
htruei
(as, ts ∪ {n1})
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
hfalsei
Intuition: the lock gave up ownership over the heap
relh
1
Transitions don’t change the other part!
Transitions don’t change the other part! Transitions = Guarantee
next 7! n2 ∗ ∗
h
hbi
next 7! n2 ∗ ∗
h
hbi
next 7! n2 ∗ ∗
h
hbi
Transitions of transposed = Rely
next 7! n2 ∗ ∗
h
hbi
Transitions of transposed = Rely
reminiscent to tokens by Turon et al. [POPL’13, ICFP’13]
Intuition: Connect communication channels with right polarity
` ⇣
p ⇣
Intuition: Connect communication channels with right polarity
` ⇣
p ⇣
Intuition: Connect communication channels with right polarity
acq acq acq acq rel rel rel rel
Connect two concurroids by connecting some of their acquire/release transitions.
Connect two concurroids by connecting some of their acquire/release transitions. Connected A/R transitions become internal for the entanglement.
leaves all loose.
shuts channels of the right operand, leaves left one’s loose
leaves all loose.
shuts channels of the right operand, leaves left one’s loose
Lemma: U ⋊ (V1 × V2) = (U ⋊ V1) ⋊ V2
READ, WRITE, SKIP and various RMW-commands
manipulation with auxiliaries
lock = { x := DRAW; while (!TRY(x)) SKIP; } unlock = { INCR_OWN; }
lock = { x := DRAW; while (!TRY(x)) SKIP; } unlock = { INCR_OWN; }
TRY(n1)(s, s0, res) ,
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
TRY(n1)(s, s0, res) ,
∧ res = true ∧ res = false
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
TRY(n1)(s, s0, res) ,
∧ res = true ∧ res = false
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
TRY(n1)(s, s0, res) ,
∧ res = true ∧ res = false
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
TRY(n1)(s, s0, res) ,
∧ res = true ∧ res = false
x := DRAW;
x := DRAW;
` ⇣ (as, ts)
... ...
x = n1 ∧
` ⇣ (as, ts ∪ {n1})
... ...
x := DRAW;
` ⇣ (as, ts)
... ...
x = n1 ∧
` ⇣ (as, ts ∪ {n1})
... ...
lock = { while (!TRY(x)) SKIP; }
x := DRAW;
` ⇣ (as, ts)
... ...
x = n1 ∧
` ⇣ (as, ts ∪ {n1})
... ...
lock = { while (!TRY(x)) SKIP; }
x := DRAW;
| {z }
Defined in
` ⇣
p ⇣
⊕
` ⇣ (as, ts)
... ...
x = n1 ∧
` ⇣ (as, ts ∪ {n1})
... ...
{p}C {q} @ U r stable under V {p ⇤ r} injectV C {q ⇤ r} @ U o V
INJECT
⧓
where ⧓ = ⋈, ⋊, ⋉,×...
{p}C {q} @ U r stable under V {p ⇤ r} injectV C {q ⇤ r} @ U o V
INJECT
⧓
where ⧓ = ⋈, ⋊, ⋉,×...
lock = { while (!TRY(x)) SKIP; }
` ⇣ (as, ts)
... ...
` ⇣ (as, ts ∪ {n1})
... ...
x :=
DRAW ;
x = n1 ∧
lock = { while (!TRY(x)) SKIP; }
` ⇣ (as, ts)
... ...
` ⇣ (as, ts ∪ {n1})
... ...
x :=
DRAW ;
injectp(
)
x = n1 ∧
lock = { while (!TRY(x)) SKIP; }
` ⇣ (as, ts)
... ...
` ⇣ (as, ts ∪ {n1})
... ...
x :=
⊕ ⊕
DRAW ;
injectp(
)
x = n1 ∧
p ⇣ hs
... ...
p ⇣ hs
... ...
lock = { while (!TRY(x)) SKIP; }
` ⇣ (as, ts)
... ...
` ⇣ (as, ts ∪ {n1})
... ...
x :=
⊕ ⊕
r r
DRAW ;
injectp(
)
x = n1 ∧
p ⇣ hs
... ...
p ⇣ hs
... ...
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
Γ, r : I ` {p} c {q} Γ ` {p ⇤ I} resource r in c {q ⇤ I}
RESOURCECSL
(owner, next ) = { }
next := 0; with_tlock , body
hidecoh(tlock `(owner,next)),(as,∅) {
} body;
(owner, next ) = { }
next := 0; with_tlock , body
Scoped concurroid creation/disposal hidecoh(tlock `(owner,next)),(as,∅) {
} body;
} body;
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
` ⇣
hfalsei
(as, ts) (1, ∅)
p ⇣
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
` ⇣
hfalsei
(as, ts) (1, ∅)
p ⇣
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
` ⇣
hfalsei
(as, ts) (1, ∅)
p ⇣
h
next 7! 0
hs ho
∗ ∗
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
` ⇣
hfalsei
(as, ts) (1, ∅)
∗ ∗
h
next 7! 0
p ⇣ hs
ho
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
p ⇣ h0
s
⊕
next 7! n2
` ⇣
hbi
h0
(1, ∅)
∗ ∗
(a0
s, t0 s)
` ⇣
hfalsei
(as, ts) (1, ∅)
∗ ∗
h
next 7! 0
p ⇣ hs
ho
} body;
p ⇣ ho
hs
h
∗ ∗ ∗
next 7! 0
Concurroid spec Initial “self” auxiliaries
⊕
p ⇣ h0
s
⊕
next 7! n2
` ⇣
hbi
h0
(1, ∅)
∗ ∗
(a0
s, t0 s)
p ⇣
∗ ∗ ∗
next 7! n2
h0
h0
s
h0
hfalsei
(as, ts) (1, ∅)
∗ ∗
h
next 7! 0
p ⇣ hs
ho
{p1}C1 {q1} @ U {p2}C2 {q2} @ U {p1 ~ p2}C1 k C2 {q1 ~ q2} @ U
PAR
{p1}C1 {q1} @ U {p2}C2 {q2} @ U {p1 ~ p2}C1 k C2 {q1 ~ q2} @ U
PAR
“Fork-shuffling” is handled by subjectivity: R/G are encoded by U.
shallow embedding into the CIC
specifications are monadic types
among concurroids
Goal 1: Model fine-grained concurrent resources with arbitrary protocols
Goal 1: Model fine-grained concurrent resources with arbitrary protocols Goal 2: Combine simplicity and modularity of Concurrent Separation Logic with the power of Rely-Guarantee reasoning
Concurroids
Goal 1: Model fine-grained concurrent resources with arbitrary protocols Goal 2: Combine simplicity and modularity of Concurrent Separation Logic with the power of Rely-Guarantee reasoning Proposal:
“fine-grained resources”
Concurroids
Goal 1: Model fine-grained concurrent resources with arbitrary protocols Goal 2: Combine simplicity and modularity of Concurrent Separation Logic with the power of Rely-Guarantee reasoning
Proposal:
“fine-grained resources”
Concurroids
Goal 1: Model fine-grained concurrent resources with arbitrary protocols Goal 2: Combine simplicity and modularity of Concurrent Separation Logic with the power of Rely-Guarantee reasoning
Thanks! Proposal:
“fine-grained resources”
CSL + FG protocols
Bornat et al. [POPL'05]
Parkinson et al. [POPL'07]
Gotsman et al. [APLAS'07]
Dindsdale-Young et al. [ECOOP'10]
Svendsen et al. [ESOP'13]
Svendsen and Birkedal [HOPE'13]
RG + Resource composition
Feng et al. [ESOP'07]
Vafeiadis and Parkinson [CONCUR'07]
Feng [POPL'09]
Dods et al. [ESOP'09]
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } +
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 } { as ↦ 0, ao ↦ n + 0 }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 } { as ↦ 0, ao ↦ n + 0 } { as ↦ 1, ao ↦ n1 }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 } { as ↦ 0, ao ↦ n + 0 } { as ↦ 1, ao ↦ n1 } { as ↦ 1, ao ↦ n2 }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 } { as ↦ 0, ao ↦ n + 0 } { as ↦ 1, ao ↦ n1 } { as ↦ 1, ao ↦ n2 } { as ↦ 1 + 1, ∃n’, ao ↦ n’, n1 = n + 1, n2 = n’ + 1 }
unlock;
x := x + 1;
as := as + 1; lock; unlock;
x := x + 1;
as := as + 1; (as ⊕ ao) RI(lock) ≝ x ↦ { as ↦ , ao ↦ n } + { as ↦ 0, ao ↦ n + 0 } { as ↦ 0, ao ↦ n + 0 } { as ↦ 1, ao ↦ n1 } { as ↦ 1, ao ↦ n2 } { as ↦ 2, ao ↦ - }
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
∧ res = true ∧ res = false
TRY(n1)(s, s0, res) ,
s =
∧
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else
(n1 = n0
1)
s0 = s s0 = p ⇣
ho
hs ⊕ h
⊕
(ao, to)
next 7! n2 ∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
∧ I(as ⊕ ao)h
Not stable!
∧ res = true ∧ res = false
TRY(n1)(s, s0, res) ,
TRY(n1)
s =
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
TRY(n1)
s =
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else (n1 = n0
1)
s0 =
⊕
∧
I(as ⊕ ao)h
∃h0
2, t0
∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
next 7! n0
2
(ao, t0
p ⇣ hs ⊕ h h0
TRY(n1)
∃h0
1, n0 2, t0
p ⇣ h0
s0 =
∧ res = true ∧ coh(s0) ⊕
∗ ∗
` ⇣ (as, ts ∪ {n1})
1
hb0i h0
next 7! n0
2
(a0
∧coh(s0)
s =
(ao, to)
next 7! n2 ∗ ∗
` ⇣
h
(as, ts ∪ {n1})
1
hbi
p ⇣ hs ho
⊕
if then else (n1 = n0
1)
s0 =
⊕
∧
I(as ⊕ ao)h
∃h0
2, t0
∗ ∗
` ⇣
emp
(as, ts ∪ {n1})
htruei
next 7! n0
2
(ao, t0
p ⇣ hs ⊕ h h0
TRY(n1)
∃h0
1, n0 2, t0
p ⇣ h0
s0 =
∧ res = true ∧ coh(s0) ⊕
∗ ∗
` ⇣ (as, ts ∪ {n1})
1
hb0i h0
next 7! n0
2
(a0
∧coh(s0)
a lower bound to the joint contribution: “I know what is my contribution.”
an upper bound for the contribution:
“When everyone is done, we can the auxiliaries are summed up. ”
hself ⊕ hother ⊕ hshared is defined
(as, ts) ⊕ (ao, to) is defined
... gs ⊕ g go ... gs go ⊕ g
⟺ coh
coh
◆ ◆ ✓ ✓
...
◆ int ✓
,
...
g0
s
gs
go ⊕ g go ⊕ g
int(s1, s2) ⇒ dom(heap(s1)) = dom(heap(s2))
...
◆ int ✓
,
...
go go
gs ⊕ g
g0
s ⊕ g
acq(s1, s2) ⇒ coh(s1) ∧ coh(s2)
acq(s1, s2) ⇒ other(s1) = other(s2)
∗
lkw 7! bw lkr 7! br ∗
count 7! n∗
(mw
s , as)
(mw
(mr
(mr
s, Ns)
h
count 7! n
h hw hr
Ir(Ns ⊕ No, hr) , (Ns ⊕ No = n) ∧ (Ns ⊕ No = 0 = ⇒ hr = emp)
Iw(as ⊕ ao, hw) , . . .
∗
lkw 7! bw lkr 7! br ∗
count 7! n∗
(mw
s , as)
(mw
(mr
(mr
s, Ns)
h
count 7! n
h hw hr
Ir(Ns ⊕ No, hr) , (Ns ⊕ No = n) ∧ (Ns ⊕ No = 0 = ⇒ hr = emp)
Iw(as ⊕ ao, hw) , . . .