Distributed Systems – Synchronization Assignment
Part 1: Conceptual Understanding
1. Introduction to Synchronization
- Synchronization refers to coordinating time, event order, or shared resource access in
distributed systems. It is essential because distributed nodes have separate clocks and no
shared memory.
- Synchronization ensures correct coordination by maintaining consistent event ordering.
2. Issues in Synchronization
- No global clock and no shared memory cause communication delays and inconsistent local
clocks.
- Clock skew: difference in current time between clocks.
- Clock drift: difference in the rate clocks run. Both cause synchronization errors.
Part 2: Algorithms
Cristian’s Algorithm
- Client requests time from server.
- Server sends time.
- Client calculates delay and adjusts clock.
- Issues: network delay, server failure, trust in server.
Berkeley Algorithm
- Master polls clocks, averages time, sends adjustments.
- Differs from Cristian’s because it uses internal averaging.
- Advantages: no external server, fault tolerance. Limitations: master failure.
Lamport’s Logical Clocks
- Logical clocks track event order.
- Happened-before relation defines causality.
- Ensures consistency by incrementing timestamps and comparing message timestamps.
Vector Clocks
- Array of counters representing each process.
- Address Lamport’s limitation by detecting concurrency.
Part 3: Practical Scenarios
Totally Ordered Multicasting
- Prevents inconsistent updates across locations by enforcing identical message order.
Mutual Exclusion
- Critical section problem requires only one process to access shared resource.
- Centralized: simple but single point failure.
- Decentralized: voting but disagreement possible.
- Distributed: many messages required.
Part 4: Critical Analysis
Lamport’s failures occur when detecting concurrency; vector clocks fix this.
Vector clocks are best when full causality is required.
Real-time gaming requires Cristian’s/NTP because they use real physical time.
Part 5: Application
Chat system example using vector clocks ensures correct ordering and concurrency
detection.