Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

UNIT II MESSAGE ORDERING & SNAPSHOTS

Message ordering and group communication: Message ordering paradigms –Asynchronous execution with
synchronous communication –Synchronous program order on an asynchronous system –Group
communication – Causal order (CO) – Total order. Global state and snapshot recording algorithms:
Introduction –System model and definitions –Snapshot algorithms for FIFO channels

Explain Group Communication.How causal and total order can be implemented?

Group communication

 Group communication is done by broadcasting of messages.


 A message broadcast is the sending of a message to all members in the distributed system.
 The communication may be
 Multicast: A message is sent to a certain subset or a group.
 Unicasting: A point-to-point message communication.

The network layer protocol cannot provide the following functionalities:

 Application-specific ordering semantics on the order of delivery of messages.


 Adapting groups to dynamically changing membership.
 Sending multicasts to an arbitrary set of processes at each send event.
 Providing various fault-tolerance semantics.

Closed Group

 Only the members of the group can send a message to the group. An outside process cannot send a
message to the group.

Open Group

 Any process in the system can send message to the group.


Explain Causal Order and Raynal-Schiper-Toueg Algorithm

Causal order (CO)


 Causal ordering of messages was proposed by Birman and joseph.
 Multiple sender send messages to multiple receivers.
 If send (m1) happens before send (m2) ,then every recipient must receive m1 before m2.
 If two message events are not causally related, the two messages may be delivered to the
receivers in any orders.
 Two message sending events are said to be casually related if they are correlated by the
happened before relation.

Consider Figure a, which shows two processes P1 and P2 that issue updates to the three replicas
R1(d), R2(d), and R3(d) of data item d. Message m creates a causality between send(m1) and
send(m2). If P2 issues its update causally after P1 issued its update, then P2’s update should be
seen by the replicas after they see P1’s update, in order to preserve the semantics of the
application.

Figure (b) shows that R1 sees P2’s update first, while R2 and R3 see P1’s update first. Here, CO is
violated.

Raynal-Schiper-Toueg Algorithm

 Each process maintain n x n matrix –the SENT matrix.


 SENT[i,j] is the number of messages sent by process pi to process pj.
 A process also maintain an array DELIV of size n where n represents number of messages
delivered to pi from all others.
 Every message transmitted by pi is tagged with content of SENTi .
 On receiving a message say m, process pj can determine whether m can be delivered by
comparing DELIVj with SENT matrix tagged m.if m can be delivered ,SENT matrix tagged m can
be discarded.

Explain in detail about Kshemkalyani –Singhal optimal algorithm (or)

What is Explicit and Implicit tracking .Explain in detail.

Explicit tracking Tracking of (source, timestamp, destination) information for messages (i) not known to
be delivered and (ii) not guaranteed to be delivered in CO, is done explicitly using the l.Dests field of
entries in local logs at nodes and o.Dests field of entries in messages.

Implicit tracking Tracking of messages that are either (i) already delivered, or (ii) guaranteed to be
delivered in CO, is performed implicitly. The information about messages (i) already delivered or (ii)
guaranteed to be delivered in CO is deleted and not propagated because it is redundant as far as
enforcing CO is concerned.

Multicasts M5,1 and M4,2

Message M5,1 sent to processes P4 and P6 contains the piggybacked information M5,1.Dests =
{P4,P6}. Additionally, at the send event (5,1) the information M5,1.Dests = {P4,P6} is also inserted in
the local log Log5. When M5,1 is delivered to P6, the piggybacked information P4 ∈ M5,1.Dests is
stored in Log6 as M5,1.Dests = {P4}; information about P6 ∈ M5,1.Dests which was needed for routing,
must not be stored in Log6 because constraint I.
Multicast M4,3

At event (4, 3), the information “P6 ∈ M5,1 ” in Log4 is propagated on multicast M4,3 only to process
P6 to ensure causal delivery using the Delivery Condition. The piggybacked information on message
M4,3 sent to process P3 must not contain this information because of constraint II.

Learning implicit information at P2 and P3

When message M4 2 is received by processes P2 and P3, they insert the piggybacked information in
their local logs, as information M5,1= {P6}. They both continue to store this in Log2 and Log3 and
propagate this information on multicasts until they “learn” at events (2, 4) and (3, 2) on receipt of
messages M3,3 and M4,3, respectively. Hence by constraint II, this information must be deleted from
Log2 and Log3. The logic by which this “learning” occurs is as follows:

 When M4,3 with piggybacked information “M5,1.Dests = ∅” is received by P3 at (3, 2), this is
inferred to be valid current implicit information about multicast M5,1.
 The logic by which P2 learns this implicit knowledge on the arrival of M3,3 is identical.

Processing at P6

Recall that when message M5,1 is delivered to P6, only M5,1={P4} is added to Log6. P6 propagates only
M5,1.Dests = {P4} on message M6,2, and this conveys the current implicit information M5,1 has been
delivered to P6, by its very absence in the explicit information.

• When the information P6 ∈ M5,1.Dests arrives on M4,3, piggybacked as M5,1 = {P6} it is used
only to ensure causal delivery of M4,3 using the Delivery Condition, and is not inserted in Log6.
• When the information “P6∈M5,1.Dests arrives on M5,2, piggybacked as M4,5.Dests = {P4,P6}.
Log6 contains M5,1= ∅ which gives the implicit information that M5,1 has been delivered or is
guaranteed to be delivered in causal order to both P4 and P6.
Explain Total Order in detail

Total Order

 It ensures that all messages are delivered to all receiver processes in the same order.
 For each pair of processes Pi and Pj and for each pair of messages Mx and My that are delivered
to both the processes, Pi is delivered Mx before My if and only if Pj is delivered Mx before My.
Centralized Algorithm for total ordering

Each process sends the message it wants to broadcast to a centralized process, which relays all the
messages it receives to every other process over FIFO channels.

(1) When process Pi wants to multicasts a message M to group G:

(1a) send M(i, G) to central coordinator

(2) When M(i, G) arrives from Pi at the central coordinator

(2a) send M(i, G) to all members of the group G.

(3) When M(i, G) arrives at pj from the central coordinator

(3a) deliver M(i, G) to the application.

Complexity: Each message transmission takes two message hops and exactly n messages in a

system of n processes.

Drawbacks: A centralized algorithm has a single point of failure and congestion, and is not

an elegant solution.

Three phase Distributed Algorithm

Sender:

Phase 1: In the first phase, a process multicasts (line 1b) the message M with a locally unique tag and
the local timestamp to the group members.

Phase 2: In the second phase, the sender process awaits a reply from all the group members who
respond with a tentative proposal for a revised timestamp for that message M.

Phase 3: In the third phase, the process multicasts the final timestamp to the group .

Receivers:

Phase1: Receivers receives the message with tentative timestamp.it updates the variable priority then
revises the timestamp.

Phase2: The receiver sends the revised timestamp back to the sender.
Phase3: Final timestamp received from multi caster.

Complexity

This algorithm uses three phases, and, to send a message to n−1 processes, it uses 3(n−1) messages
and incurs a delay of three message hops

*****************************

Global state and snapshot recording algorithms

System Model

 The system consists of a collection of n processes, p1, p2,…, pn that are connected by
channels.
 Let Cij denote the channel from process pi to process pj.
 Processes and channels have states associated with them.
 The state of a process at any time is defined by the contents of processor registers,
stacks, local memory, etc.,
 The state of channel Cij, denoted by SCij, is given by the set of messages in transit
in the channel.
 In the FIFO model, each channel acts as a first-in first-out message queue and, thus, message
ordering is preserved by a channel.
 In the non-FIFO model, a channel acts like a set in which the sender process adds messages
and the receiver process removes messages from it in a random order.

A consistent global state

The global state of a distributed system is a collection of the local states of the processes and the
channels. The global state is given by:

The two conditions for global state are:


 In a consistent global state, every message that is recorded as received is also
recorded as sent. Such a global state captures the notion of causality that a
message cannot be received if it was not sent.
 Consistent global states are meaningful global states and inconsistent global states
are not meaningful in the sense that a distributed system can never be in an
inconsistent state.

Explain Snapshot algorithms for FIFO channels in detail.

 A snapshot captures the local states of each process along with the state of each
communication channel.
 Snapshots are required to:
 Checkpointing
 Collecting garbage
 Detecting deadlocks
 Debugging

Chandy–Lamport algorithm

 Chandy–Lamport algorithm records a set of process and channel states such that the combination is
a global state.communication channels assumed to be FIFO.
 Assumptions
 No Failure in process and channels
 Communication channels are unidirectional and FIFO channels
 There is a communication channel between each pair of processes.
 Any process may initiate the snapshot.

The Algorithm

 A process initiates snapshot collection by executing the marker sending rule by which it records
its local state and sends a marker on each outgoing channel.
 A process executes the marker receiving rule on receiving a marker. If the process has not yet
recorded its local state, it records the state of the channel on which the marker is received as
empty and executes the marker sending rule to record its local state.
 Otherwise, the state of the incoming channel on which the marker is received is recorded as the
set of computation messages received on that channel after recording the local state but
before receiving the marker on that channel.
Example:

Process p1 records its state in the actual global state S0 , when the state of p1 is <$1000,
0>.Following the marker sending rule, process p1 then emits a marker message over its outgoing
channel c2 before it sends the next application-level message: (Order 10, $100), over channel c2 .
The system enters actual global state S1 . Before p2 receives the marker, it emits an application
message (five widgets) over c1 in response to p1 ’s previous order, yielding a new actual global
state S2 .Now process p1 receives p2 ’s message (five widgets), and p2 receives the marker.
Following the marker receiving rule, p2 records its state as <$50, 1995> and that of channel c2 as
the empty sequence. Following the marker sending rule, it sends a marker message over c1 .When
process p1 receives p2 ’s marker message, it records the state of channel c1 as the single message
(five widgets) that it received after it first recorded its state.The final recorded state is p1 : <$1000,
0>; p2 : <$50, 1995>; c1 : <(five widgets)>; c2 : < >. Note that this state differs from all the global
states through which the system actually passed.

Explain Spezialetti-Kearns algorithm(FIFO) in detail. (or)

Explain Variations of the Chandy–Lamport algorithm

Spezialetti–Kearns algorithm:

 In the Spezialetti-Kearns algorithm, a markers carries the identifier of the initiator of the
algorithm.
 Each process has a variable master to keep track of the initiator of the algorithm.
 A key notion used by the optimizations is that of a region in the system. A region encompasses
all the processes whose master field contains the identifier of the same initiator.
 The identifier of the concurrent initiator is recorded in a local variable id-border -set.
 The state of the channel is recorded just as in the Chandy-Lamport algorithm.
 Snapshot recording at a process is complete after it has received a marker along each of its
channels.
 After every process has recorded its snapshot,the system is partitioned into as many regions as
the number of concurrent initiations of the algorithm.
 Variable id-border-set at a process contains the identifiers of the neighboring regions.

Efficient dissemination of the recorded snapshot

In the snapshot recording phase, a forest of spanning trees is implicitly created in the system.

The initiator of the algorithm is the root of a spanning tree and all processes in its region belong to
its spanning tree.

1) If Pi receives its first marker from Pj then: process Pj is the parent of process Pi in the spanning
tree.

2) When an intermediate process in a spanning tree has received the recorded states from all its
child processes and has recorded the states of all incoming channels, it forwards its locally recorded
state and the locally recorded states of all its descendent processes to its parent.

3) When the initiator receives the locally recorded states of all its descendants from its children
processes, it assembles the snapshot for all the processes in its region and the channels incident on
these processes.
4) The initiator exchanges the snapshot of its region with the initiators in adjacent regions in
rounds.

Alagar-Venkatesan algorithm

1 When a process receives the token, it takes its snapshot, initializes the state of all channels to
empty, and returns Done message to the initiator. Now onwards, a process includes a message
received on a channel in the channel state only if it is an old message.

2 After the initiator has received Done message from all processes, it broadcasts a Terminate
message.

3 A process stops the snapshot algorithm after receiving a Terminate message.

You might also like