Distributed Computing and Communication Design Principles (4)
Distributed Computing and Communication Design Principles (4)
Communication Design
Principles
Here's a detailed breakdown of Distributed Computing
and Communication Design Principles (Part 1)
covering:
Model of Distributed Executions (Processes, Events,
Logical Clocks)
Models of Communication Networks (Shared Memory,
Message Passing)
Global State in a Distributed System and its
Challenges
A Model of Distributed Executions
P1 a → b → c → d
P2 e→f→g
P3 h→i Causal Order: a < b < c < d at P1, and messages
Timestamps: propagate timestamps accordingly.
P1: 1 → 2 → 3 → 4
P2: 1→2→3
P3: 1→2
Process
Execution with
Causal Ordering
This diagram illustrates the execution of three processes (P1, P2, and P3) with their local events and
timestamps as specified:
P1: Events a→b→c→d with timestamps 1→2→3→4
P2: Events e→f→g with timestamps 1→2→3
P3: Events h→i with timestamps 1→2
The diagram shows message passing between processes that respects the causal ordering. In particular:
1. After event b (timestamp 2) at P1, a message is sent to P2
2. Process P2 sends a message to P3 after event e (timestamp 1)
3. After event d (timestamp 4) at P1, a message is sent to P3
This maintains the causal ordering requirement where a < b < c < d at P1, and ensures that timestamps
propagate accordingly between processes. The messages carry the causal dependencies between processes,
showing how events in one process can influence events in another.
Models of Communication Networks
Shared Memory Model
Processes communicate via a shared memory space.
Read and Write operations: Processes can write data and later read it.
Used in multiprocessor systems with a common memory bus.
Advantages
✅ Low communication overhead.
✅ No message loss or duplication.
Disadvantages
❌ Hard to implement in geographically distributed systems.
❌ Synchronization (e.g., locks, semaphores) is complex.
Diagram: Shared Memory Model
P1 → Shared Memory ← P2
[Data Block]
Shared Memory
Model with Data
Block
I've created a diagram illustrating the shared memory model showing two processes (P1 and P2) that
communicate through a shared memory region. The shared memory contains a data block with various
elements:
1.Two variables (X and Y) that both processes can read from or write to
2.An array (A) for larger data structures
3.A semaphore (S) for synchronization between processes
In this model:
Both processes have direct access to the same memory space
Processes can communicate by writing to and reading from this shared memory
Synchronization mechanisms (like the semaphore shown) are typically used to control access and prevent
race conditions
No message passing is required since data is directly accessible by both processes
This model is common in multi-core systems, multi-processor systems, and some specialized distributed
systems where memory can be physically shared
Message Passing Model
Processes communicate by sending and receiving messages.
Used in distributed computing systems where shared memory is not feasible.
Two Types of Message Passing
Synchronous: Sender waits for acknowledgment.
Asynchronous: Sender doesn’t wait.
Advantages
✅ Works well for distributed systems.
✅ No need for shared memory.
Disadvantages
❌ Message loss, duplication, and reordering are challenges.
❌ Requires complex protocols like TCP for reliability.
Diagram: Message Passing Model