Professional Documents
Culture Documents
Distributed System
Shah Khalid
Shah.khalid{@}seecs.edu.pk
National University of Sciences and Technology (NUST)
In last few lectures
• Causal Ordering Algorithms- Synchronization
• Mutual Exclusion Algorithms
• Election Algorithms
Today
Global State
Consistent , Inconsistent and Strongly consistent State
Why Global state
Algorithm- Chandy - Lamport Snapshot Algorithm
System Model
• A distributed system consists of multiple processes
• N process in the system
• Each process is located on a different computer
• Each process consists of “events”
• An event is either sending a message, receiving a
message, or changing the value of some variable
• Each process has a communication channel in and
out
Initial Problem Example
• Each process is located on a different computer
• No sharing of processor or memory
• Each process can only determine its own “state”
• Problem: How do we determine when to garbage
collect in a distributed system?
• How do we check whether a reference to memory still
exists?
Our Garbage Collection Problem
• In order to test whether a certain property of our
system is true, we cannot just look at each process
individually
• A “snapshot” of the entire system must be taken to
test whether a certain property of the system is
true
• This “snapshot” is called a Global State
Definition
The global state of a distributed system is the set of
local states of each individual processes involved in
the system plus the state of the communication
channels.
Problems (cont’d)
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)
Global state recorded
p q
m m
Another view
p
m
q
Another view
• Process p has no record of sending m
• Process q HAS record of receiving m
• Problem?
• Global state does not show p sending m, therefore there
is confusion as to where m came from
• Breaks the Consistency concept
Consistency
• A global state is consistent if it could have been
observed by an external observer
• If e e` , then both e and e` must reside within
the same state
• For a successful Global State, all states must be
consistent
Assumptions
• Distributed system: Finite set of processes and
channels;
• Processes
• Set of states, initial state, set of events
• Channels
• FIFO, error-free, infinite buffers, arbitrary but finite
delay
Idea of a global state recording
algorithm
- each process records its own state
- the two processes incident by one channel
cooperate in recording the channel state
Meaningful:
The notion of Consistency
Sp1 Sq1
Sp1 Sq1
Sp2 Sq3
m3
Sp2 Sq3
m3
Sp1 Sq3
• Features:
• Does not promise us to give us exactly what is there
• But gives us consistent state!!
Conclusion