VMCAI / POPL 2009 Spy Report. Topics of Interest (I). Semantics of concurrent programs Programming languages & abstractions Transactional memory (TM) Alternative models Message passing Functional programming. Topics of Interest (II). Verifying concurrent programs
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
VMCAI / POPL 2009Spy Report
atomic{
// touch shared memory, etc.
}
E.g.,atomic { if(..) launch_missile(); }
atomic { if(x == 0) x = 1; }‖x = 2;
high-level semantics
atomic blocks,
retry, abort, …
programming discipline
Low-level semantics &
implementation
(optimistic concurrency,
lock-based, …)
TM
all
programs
violation
freedom
dynamic
separation
static
separation
programming discipline
TM
“worse
concurrency”
“better
concurrency”
a sequence of operations
read(xi),write(xi,v), abort, commit
which return either a value, “ok”, or “abort”
overlap
conflict on xi:
overlap + read/write or
write/write to xi
Ti
Tj
History
abort/
commit
abort/
commit
plus,
(TL2, TinySTM, RSTM, McRT-STM,…)
If writing to x, must hold lock on x
If hold lock on x, must write to x
If several processes compete for the lock, one succeeds.
write(x, v)
try-lock(Lx)
For any TM implementation M, if every history of M has a strong try-lock extension, then M is strongly progressive.
(does not require, e.g., CAS)
strongly-progressive TM ≡ strong try-locks
consensus number of strong try-locks ≥ 2
consensus number of strong try-locks ≤ 2
(L : a strong try-lock ; V0,V1 : registers)
process pi executes:
write(Vi, v)
locked← try-lock(L)
if(locked)
decide v
else
decide read(V1-i)
Never unlocked…
Because L is a strong try-lock,
one process grabs it even
if both try at the same time.
Weak
Assume/Guarantee
process/
thread
receive messages,
read values
send messages,
write values
assumption
guarantee
⇒ A holds (under no assumptions).
assume
p0
p1
guarantee
guarantee
assume
p0
p1
safety property p1
p0
p1
liveness property p2
⋮
⋮
p0
p1
termination
(safety) Λ “operations x,y,z are not called infinitely often”
⇒ automated search procedure
(disclaimer:
may require
prophecy
variables)
if x == null
if x != null
Concurrent implementation
Abstract (sequential) spec
pop:
return success;
return failure;
if x == null
if x != null
Given by user or
inferred automatically
instrumented executable
program
control
logic
i can has lock?
yes/wait
{precondition} … {postcondition}
E.g.,
{x > 0} y := x { y > 0 }
⇩
(x = 0) Λ (y = x) Λ (y <= 0)
SAT?
Spec#
function f(n)
{x := 0; y := 0;
while(x++ <= n) {
while(y++ <= m) {
// foo}}}
Invariant: c1≤ n
Invariant: c2≤ m
Bound ≤ n∙m
c1 := 0 ; c2 := 0;
c1 ++ ; c2 := 0;
c2 ++ ;
Goal: maintain temp ∈ [tlow, thigh]
condition1
ON
OFF
condition2
temperature
temperature
?
Invariant
?
?
Controlled
Inductive
Invariant
Template:
a11x2+ a12x2 + … ≤ b1
…
Add constraints for
controllability (∀∃)
⇩
Use SMT solver to
find a11, a12,…