Title: Shared Variables Interaction Diagrams
1 Shared Variables Interaction Diagrams
- Radu Grosu
- State University of New York at Stony Brook
- joint work with
- Rajeev Alur
- University of Pennsylvania
2Motivation
- Scenario-based specifications are very popular in
concurrent systems development - intuitive description of design requirements,
- intuitive presentation of system executions,
- compact presentation test sequences.
3Fact
- Concurrent systems are usually constructed around
one of the following communication models - Shared variables
- Message passing
4Message Passing
- standardized notation in form of MSCs (UML-SDs)
- precise semantics subjected to analysis,
- algorithms and tools (race conditions, timing
conflicts)
5Shared Variables?
- No formal notation so far!
- but plenty informal diagrams
6In This Work
- Define Shared Variables Interaction Diagrams
(SVID) - introduce the notion of consistent SVID,
- analyze complexity of consistency checking
- many-to-many communication
- one-to-many communication
- Define refinement notion between SVIDs
- intuitive syntactic refinement steps,
- analyze complexity of refinement checking
- many-to-many communication
- point-to-point communication
7Peterson Mutual Exclusion Protocol
p1
p2
p1
p2
ini
f2F
idle
f1 T p1 wants to enter critical section f2 T
p2 wants to enter critical section t 1 p1 has
priority
8Processes
p1
p2
p1.Xr f2 - read variables p1.Xs t
- write shared variables p1.Xe f1 - write
exclusive variables p1.Xw t,f1 - write
variables p1.X t,f1,f2 - all variables
9Vertices
p2
p1
v11
v21
v12
v22
v13
v23
v24
v14
10Vertices
p2
p1
v11
v21
linear order time flow
idle
v1i.p p1 p1.V v11,v12,v13,v14 V p1.V ?
p2.V lt ltp1 ? ltp2
v12
v22
v13
v23
v24
f1
v14
ltp1
11Atomic Update Boxes
p1
p2
f1F
f2F
f2T t 1
v12
v13
f1
12Read Edges
p1
p2
no intervening vertex writes t
v22
v12
partial order among vertices
v13
v23
v24
f1
13Consistent SVID
There is a sequence v1 v2 vn that (1) is
consistent with time order lt (2) is consistent
with read order E (3) respects most recent
updates.
14Inconsistent SVID
p1
p1
v11
v21
v12
v22
15Checking Consistency
One-to-many communication (write exclusive) -
Solved in linear time. - Reduces to finding a
cycle in a graph. Many-to-many communication
(write shared) - In general NP complete. -
Resolving implicit dependencies -gt backtrack.
16Refinement
- When does I refine S written I ? S?
- Interested in a refinement notion that has a
syntactic counterpart that guides users. - Three simple ways to refine an SVID
- - By moving arrows and adding empty boxes.
- By splitting vertices.
- By splitting processes.
17Moving Arrows Adding Empty Boxes
18Splitting Vertices
19Splitting Processes
?
20Refinement
- When does I refine S written I ? S?
- Variables S.X I.X
- Processes p.X ? q.X or p.X ? q.X
- Boxes there is a surjective map r form the
vertices I to the vertices of S that preserves
the variables. - Dependency The specification partial order (S.E
? S.lt) is included in the image r(I.E ? I.lt).
21Checking Refinement
p2
p2
p1
t
p1
?
f1
f1
22Checking Refinement
Point-to-point communication - Solved in
O(V3). - Reduces to computing the transitive
closure. Many-to-many communication - In
general NP complete. - Guessing the vertex map -gt
backtrack.
23Deadlock for Dining Philosophers
24Deadlock for Dining Philosophers
p1
f3
p2
f1
f2
p3
set(F)
set(F)
set(F)
get
get
get
val(F)
val(F)
val(F)
set(T)
set(T)
set(T)
get
get
val(T)
val(T)
get
val(T)
25Wrap Up
- Defined Shared Variables Interaction Diagrams
(SVID) - introduced the notion of consistent SVID,
- analyzed complexity of consistency checking
- many-to-many communication
- one-to-many communication
- Defined refinement notion between SVIDs
- intuitive syntactic refinement steps,
- analyzed complexity of refinement checking
- many-to-many communication
- point-to-point communication