Coordination: CE32204 - Distributed System Presented By: Eka Stephani Sinambela Institut Teknologi Del
Coordination: CE32204 - Distributed System Presented By: Eka Stephani Sinambela Institut Teknologi Del
◉ Example:
○ Multiple processes do not simultaneously access a shared such as a file, but
instead cooperate in granting each other temporary exclusive access.
○ Multiple processes may sometimes need to agree on the ordering events, such as
whether message m1 from process P was sent before or after message m2 from
process Q.
Why coordination is important?
◉ Issue of synchronization
○ actual time
○ Synchronization in which only relative ordering matters rather than ordering in absolute
time
Logical Clock
The Happened-before relationship
◉ What usually matters is not that all processes agree on exactly what time it is, but
they that they agree on the order in which events occur. Requires a notion of
ordering.
◉ Problem
○ How do we maintain a global view on the system’s behavior that is consistent with
the happened-before relation?
◉ Problem
○ How to attach a timestamp to an event when there’s no global clock maintain a consistent set of
logical clocks, one per process.
Logical Clocks
◉ Solution
○ Each process Pi maintains a local counter Ci and adjust this counter
■ For each new event that takes place within Pi, Ci is incremented by 1.
■ Each time a message m is sent by process Pi, the message receives a timestamp ts(m) = Ci.
■ Whenever a message m is received by a process Pj, Pj adjusts its local counter Cj to max{Cj,
ts(m)}; then executes step 1 before passing m to the application.
○ Property P1 is satisfied by (1); Property P2 by (2) and (3).
Logical Clocks
◉ Example
○ Consider three processes with event counters operating at different rates
Logical Clocks
◉ Where implemented
○ Adjustments implemented in middleware
Vector Clocks
◉ Observation
○ Lamport’s clocks do not guarantee that if C(a) < C(b) that a causally preceded b.
○ Concurrent message transmission using logical clocks.
○ Observation
■ Event a: m1 is received at T = 16
■ Event b: m2 is sent at T = 20
◉ Example:
○ Capturing potential causality when exchanging messages
○ Analysis
Mutual Exclusion
◉ Problem
○ A number of processes in a distributed system want exclusive access to
some resource (simultaneously access the same resources).
◉ Basic solution:
○ Permission-based: A process wanting to enter its critical section, or access a
resource, needs permission from other processes.
■ Centralized algorithm
■ Distributed algorithm
Permission-based centralized
◉ Simply use coordinator
○ (a) Two processes want to access a shared resource at the same moment.
○ (b) P0 has the lowest timestamp so it wins.
○ (c) When process P0 is done, it sends OK also, so P2 can now go ahead.
Thanks!