You are on page 1of 15

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Distributed Programs
Dr. Mattox Beckman
Illinois Institute of Technology
Department of Computer Science
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Outline
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Motivation

Distributed programs are an amazing way of handling concurrency.

No interference!

Scales well to large systems.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Syntax

A sequential process has the form


S S
0
; do
m
j1
g
j
S
j
od
where

m 0 and S
0
, . . . , S
n
are nondeterminstic programs.

S
0
is the initialization code.

There may be loops inside of each S


i
.

g B;

B is a guard

is of form c?u an input command, or

c!t an output command.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Example
SR [SENDERRECIVER] (1)
SENDER i := 0; do i = |a|; link!a[i] i := i + 1 od (2)
RECEIVER j := 0; do j = |b|; link?b[j] j := j + 1 od (3)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Activity
Do the Distributed Program Activity
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Semantics

First we talk about termination.


< do
m
j=1
g
j
S
j
od , >< E, >
where for j {1, . . . , n} g
j
B
j
;
j
and |=
m
j=1
B
j

We also want to talk about the meaning of a communication.

1
= c?u

2
= c!t
Eff(
1
,
2
) = Eff(
2
,
1
) = u := t
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Communication
< [S
1
S
n
], >< [S

1
S

n
], >
S
k
= do
m
1
j=1
g
j
R
j
od
S
l
= do
m
2
j=1
h
j
T
j
od
g
j
1
= B
1
;
1
h
j
2
= B
2
;
2
|= B
1
B
2
M[[Eff(
1
,
2
)]]() = {}
S

i
S
i
for i = k, l
S

k
R
j
1
; S
k
S

l
T
j
2
; S
l
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Transforming to a nondeterministic program

Suppose each process has form


S
i
S
i,0
; do
m
i
j=1
B
i,j
;
i,j
S
i,j
od

Let be a list of matching communications:


= {(i, j, k, l)|
i,j
and
k,l
match and i < k}

Then S [S
1
S
n
] can be transformed as...
T(S) S
1,0
; S
2,0
; ; S
n,0
;
do
(i,j,k,l)
B
i,j
B
k,l
Eff(
i,j
,
k,l
); S
i,j
; S
k,l
od
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Activity
Do the Distributed Conversion Activity
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Proving Deadlock

The partial correctness will be the same, but what about deadlock?

Given
T(S) S
1,0
; S
2,0
; ; S
n,0
;
do
(i,j,k,l)
B
i,j
B
k,l
Eff(
i,j
,
k,l
); S
i,j
; S
k,l
od

We dene TERM and BLOCK. How are they different?


TERM

n
i=1

m
i
j=1
B
i,j
BLOCK

(i,j,k,l)
(B
i,j
B
k,l
)

Which is the stronger of TERM and BLOCK?

What does BLOCK TERM tell us?


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Partial Correctness: Rule 19
{p}S
1,0
; ; S
n,0
{I},
{I B
i,j
B
k,l
}Eff(
i,j
,
k,l
); S
i,j
; S
k,l
{I}
for all (i, j, k, l)
{p}S{I TERM}
What do we have to do to add weak total correctness?
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Weak Total Correctness: Rule 20
{p}S
1,0
; ; S
n,0
{I},
{I B
i,j
B
k,l
}Eff(
i,j
,
k,l
); S
i,j
; S
k,l
{I}
for all (i, j, k, l)
{I B
i,j
B
k,l
t = z}Eff(
i,j
,
k,l
); S
i,j
; S
k,l
{t < z}
for all (i, j, k, l)
I t 0
{p}S{I TERM}
What do we have to do to add total correctness?
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Total Correctness: Rule 21
{p}S
1,0
; ; S
n,0
{I},
{I B
i,j
B
k,l
}Eff(
i,j
,
k,l
); S
i,j
; S
k,l
{I}
for all (i, j, k, l)
{I B
i,j
B
k,l
t = z}Eff(
i,j
,
k,l
); S
i,j
; S
k,l
{t < z}
for all (i, j, k, l)
I t 0
I BLOCK TERM
{p}S{I TERM}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Activity
Do the Distributed Deadlock Activity

You might also like