CS8603:Distributed Systems Department of CSE
2020 – 2021 2.
12
Jeppiaar Institute of Technology
(message types)
REVISE_TS(M, i, tag, ts)
// Phase 1
message sent by Pi, with initial timestamp ts
PROPOSED_TS(j, i, tag, ts) // Phase 2 message sent by Pj ,
with revised timestamp, to P
i
FINAL_TS(i, tag, ts)
// Phase 3 message sent by Pi, with final timestamp
(1) When process Pi wants to multicast a message M with a tag tag:
(1a) clock←clock+1;
(1b)
send REVISE_TS(M, i, tag, clock) to
all processes;
(1c) temp_ts←0;
(1d)
await PROPOSED_TS(j, i, tag, ts
j
) from each process P
j
;
(1e)
∀ j ∈ N,
do temp_ts←max(temp_ts, ts
j
);
(1f)
send FINAL_TS(i, tag, temp_ts) to all processes;
(1g) clock←max(clock, temp_ts).
(2) When
REVISE_TS(M, j, tag, clk) arrives from P
j
:
(2a) priority←max_priority+1(clk);
(2b)
insert (M, tag, j, priority, undeliverable) in temp_Q;
// at end
of queue
(2c)
send PROPOSED_TS(i, j, tag_ priority) to P
j
.
(3) When
FINAL_TS(j, x, clk) arrives from P
j
:
(3a) Identify entry Q_e in temp_Q, where Q_e.tag = x;
(3b)
mark Q_e.deliverable as true;
(3c) Update Q_e.timestamp to clk and re-sort temp_Q based on the timestamp field;
(3d)
if (head(temp_Q)).tag = Q_e.tag
then
(3e)
Chia sẻ với bạn bè của bạn: