Problem Abstract Parallel Program
Design of Distributed Systems 1
Melinda Tóth and Zoltán Horváth
Dept. Programming Languages and Compilers
Eötvös Loránd University, Budapest, Hungary
1
Supported by TÁMOP-4.1.2.A/1-11/1-2011-0052
Problem Abstract Parallel Program
Contents
1 Problem
2 Abstract Parallel Program
Problem Abstract Parallel Program
Problem
The problem is defined as a set of specification relations.
Every specification relation is defined over the powerset of
the state space.
Let P, Q, R, U : A 7−→ L be logical functions.
We define
, 7→, ,→∈ P(P(A) × P(A)), and
FP, INIT, inv, TERM ⊆ P(A)
Problem Abstract Parallel Program
Specification Relations
P Q - (P stable unless Q),
P 7→ Q - (P ensures Q-t),
P ,→ Q - (Q is inevitable from P),
Q ,→ FP, Q ∈ TERM - (fixed point is inevitable from Q),
FP ⇒ R - (R holds in any fixed point),
invP - (P is invariant),
Q ∈ INIT (Q initially).
Problem Abstract Parallel Program
Example
A::=N , ::={(di = k e, di = k + 1e) | k ∈ N }.
According to i = 5 i = 6 specification requirement the
program is enabled to change state a = (5) to state
a = (6) only.
According to the specification relation the variable i is
non-decreasing and can be increased one by one.
B ...
A 3
A
4
3 ...
4
4
5
Problem Abstract Parallel Program
Problem Definition
Let A be a state space and let B be a finite or numerable
set.
The relation F ⊆ B × H, where
× P(P(A) × P(A)) × P(P(A))) is called a
H = ( i∈[1..3] i∈[1..4]
problem defined over the state space A.
B is called the parameter space of the problem.
Two relations expressing boundary properties and five relations
expressing transition properties are associated to every point of
set B.
Problem Abstract Parallel Program
Notation
Let b ∈ B denote an arbitrary element of the domain of the
problem.
Let h denote an element of F (b).
The components of h are denoted by h , 7→h , ,→h and by
INITh , FPh , invh , TERMh respectively.
If |F (b)| = 1 then we use b instead of h in the indices for
the sake of simplicity.
Problem Abstract Parallel Program
Notation
h1 = (h1 , 7→h1 , ,→h1 , INITh1 , FPh1 , invh1 , TERMh1 )
B h1
b1 h2
b2 h3
h4
....
Problem Abstract Parallel Program
Example – Value of a Function
A=X ×Y x : X, y : Y,
B = X x0 : X .
(x = x 0 ) ∈ INITx 0 (1)
True ,→ FPx 0 (2)
FPx 0 ⇒ y = f (x 0 ) (3)
Problem Abstract Parallel Program
Abstract parallel program
The abstract program is a relation
generated by a set of conditional assignments;
assignments are selected nondeterministically,
executions of different processors are fairly interleaved.
a fixed point is said to be reached in a state, if any
statement in that state leaves the state unchanged.
Problem Abstract Parallel Program
General Assignment
A statement over the state space A is called empty and
termed SKIP, if ∀a ∈ A : SKIP(a) = {< a >}.
Let A = A1 × ... × An , F = (F1 , ..., Fn ), where Fi ⊆ A × Ai .
The statement s ⊆ A × A∗∗ is a general assignment
defined by F , if
s::={(a, red(< a, b >)) | a, b ∈ A ∧ a ∈ i∈[1,n]∩ D ∧
Fi
b ∈ F (a)} ∪
{(a, < a, a, a.... >) | a ∈ A ∧ a ∈ ∩ D }.
/ i∈[1,n] Fi
Problem Abstract Parallel Program
Example
x,y : N,
x,y := x+y, x-y,
F1 (x, y ) = x + y , F2 (x, y ) = x − y ,
F = (F1 , F2 ), F (x, y ) = (x + y , x − y ),
F(2,3)=?, F(3,2)=?
Problem Abstract Parallel Program
Extension
We extend the domain of a relation for the whole state
space in the following way:
A = A1 × · · · × An ,
F ⊆ A × A,
F = (F1 , . . . , Fn ),
where Fi ⊆ A × Ai .
Let dπi e::=DFi .
The relation Fi |True is the extension of Fi for the truth set of
condition True, i.e.,
Fi |True (a)::=Fi (a), if a ∈ dπi e and
Fi |True (a)::=ai , otherwise.
F ||True ::=(F1 |True , . . . , Fn |True ).
Problem Abstract Parallel Program
Conditional Assignment
Let be sj an assignment, for which
((Dp(sj ) = A) ∧ (∀a ∈ A : p(sj )(a) = F ||↑ (a))).
This kind of (simultaneous, nondeterministic) assignment
is called a conditional assignment, if
∀a ∈ A : |p(sj )(a)| < ω.
We denote the conditional assignment sj the following way:
k
( i∈[1,n] (vi :∈ Fj i (v1 , .., vn ), if πj i )).
Simultaneous, nondeterministic, conditional assignment:
(vi :∈ Fi (v1 , .., vn ), if πi k (vk :∈ Fk (v1 , .., vn ), if πk ).
Abbreviation: k (...)
i∈[1,n]
Problem Abstract Parallel Program
Example – Abstract Program
S::=(SKIP, {
(s1 : x := x + 1, if x ≤ y k y := y + x),
s2 : z := x + y }
Atomicity:
(2, 3, 0) − (s1 )− > (3, 5, 0), (3, 5, 0) − (s2 )− > (3, 5, 8)
if no atomicity:
(2, 3, 0)−− > (3, 3, 0), (3, 3, 0)−− > (3, 3, 6)−− > (3, 5, 6)
there is no state, when x + y is 6.
Problem Abstract Parallel Program
On the Next Lecture...
Semantics of the Abstract Program
Program Properties of the Abstract Program