Presentation 1
Presentation 1
System
By John Kor and Yvonne Cheng
Initial Problem Example
Garbage Collector
Free’s up memory which is no longer in use
Check’s if a reference to memory still exists
Deterministic Computation
At any point in computation there is at most
one event that can happen next.
Non-Deterministic Computation
At any point in computation there can be
more than one event that can happen next.
Deterministic Computation
Non-Deterministic Computation
Determinism
Deterministic computation
A local event would reveal everything about
the global state!
The process will know other process’ state
Non-Deterministic computation
Because of branching, a local event cannot
reveal what the next step will be
Simple Algorithm
Very simple
Easy to implement
Problems?
State recorded by p
p q
m
Problems (cont’d)
p q
m
Problems (cont’d)
State recorded by q
p q
m
Problems (cont’d)
m m
Another view
p
m
q
Another view
- No global clock
- Need a meaningful result
- Superimposed on underlying computation
Meaningful:
The notion of Consistency
Sp1 Sq1
Sp1 Sq1
Sp2 Sq3
m3
Sp2 Sq3
m3
Sp1 Sq3
c’
An Example
c
t
c’
An Example
c
t
c’
An Example
c
t
t
c’
An Example
- n: number of messages sent along c
before p’s state is recorded
- n’: number of message sent along c
before c’s state is recorded
p q
c
c’
An Example
- Reason of inconsistency: n<n’
p q
c
t n=0
c’
p q
c
t
n’ = 1
c’
Similar scenario
n = n’
Similar Conclusion
To be consistency: m=m’
Some other equations
n’ >= m’
m’ : number of messages received along c before c’s state is
recorded
n’ : number of messages sent along c before c’s state is
recorded
m : number of messages received along c before p’s state is
recorded
n : number of messages sent along c before p’s state is
recorded
n >= m
n = n’
m = m’
Other Fact
Two cases:
n’=m’ : c is empty
n’>m’: c must be the (m’+1)st…n’th messages sent by p
along c
Put All Together:
A brief sketch of the algorithm
p sends a marker message along all its outgoing
channels after it records its state and before it sends
any other messages.
On receipt of a marker message from channel c
else
state ( c ) = messages received on c since it had
recorded its state excluding the marker.
if p has not recorded its state
record the state
state ( c ) = EMPTY
Chandy and Lamport Algorithm
Features:
Does not promise us to give us exactly what is
there
But gives us consistent state!!
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Algorithm in Action
m1 m2 m3
q
Sq0 Sq1 Sq2 Sq3
Computation may not even have
passed through the state recorded!
What have we recorded
Then
S* is reachable from Si
Sj is reachable from S*
S* Is reachable from Si
Si
Sj
Sj Is reachable from S*
Si
Sj
Still what good is it?
Stable Properties
A property Y is called a stable property
iff for all states S` reachable from S
Y(S) -> Y(S’)
Detection of Stable Properties
Outcome = false;
while ( outcome == false )
{
determine Global State S;
outcome = Y (S);
}
Checkpoint
S* serves as a checkpoint
On a failure, restart the
computation from S*
Problem!
Si
Not able to restore to Sj
S*
Sj
Solution: Publishing
A Broadcast medium
A central recorder process records all the
messages received by each process
Processes record their states at their own
time and send it to the recorder
Determining Global State
SNAPSHOT PUBLISHING
Strongly
Network connected
Need not be
Scalability Yes No
Restorability No Yes
Conclusion