0% found this document useful (0 votes)
5 views

Distributed Computing and Communication Design Principles (4)

The document provides an overview of Distributed Computing and Communication Design Principles, focusing on models of distributed executions, communication networks, and global state challenges. It discusses processes, events, logical clocks, shared memory, and message passing models, highlighting their advantages and disadvantages. Additionally, it introduces the Chandy-Lamport algorithm for capturing consistent global states in asynchronous systems.

Uploaded by

boppana200312
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Distributed Computing and Communication Design Principles (4)

The document provides an overview of Distributed Computing and Communication Design Principles, focusing on models of distributed executions, communication networks, and global state challenges. It discusses processes, events, logical clocks, shared memory, and message passing models, highlighting their advantages and disadvantages. Additionally, it introduces the Chandy-Lamport algorithm for capturing consistent global states in asynchronous systems.

Uploaded by

boppana200312
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Distributed Computing and

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

Processes, Events, and Logical Clocks


A distributed system consists of multiple processes that run on different machines,
communicating through a network. There is no global clock, so processes must rely on
their own logical order of events.
Processes
•A process is an independent entity executing instructions.
•Each process executes sequentially and can communicate with other processes.
Events
Local events: Computation performed within a process.
Send/receive events: Communication between processes.
Causal order: Some events influence others.

Logical Clocks (Lamport Clocks)


To establish a logical sequence of events in a system without a global clock, we use logical
clocks:
1.Lamport Timestamps: Assigns a logical timestamp to each event.
•If an event e1 happens before e2, then C(e1) < C(e2).
•Each process maintains a counter, increasing on internal events and sending its value along
with messages.
Vector Clocks: Captures causality by maintaining an array of counters.
Each process maintains a vector with timestamps from all processes.

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

P1 ───► Network ───► P2


Message Passing Model with Network
Communication
I've created a diagram illustrating the message passing model showing two processes (P1 and P2)
communicating through a network. The diagram highlights several key aspects of this
communication model:
1.Message Flow:
1. Process P1 sends a message (M1) to the network
2. The network delivers the message to Process P2
3. Process P2 can send a response message (M2) back through the network
4. The network delivers the response to Process P1.
Message Structure:
Header containing source, destination, and message ID
Payload with the actual data being transmitted
Checksum/CRC for error detection
Synchronization Methods:
Asynchronous communication (non-blocking send)
Synchronous communication (blocking until acknowledgment)
Timeout and retry mechanisms for reliability
In this model:
 Processes don't share memory and must explicitly pass messages to communicate
 The network introduces potential delays, packet loss, and ordering issues
 Proper synchronization is required to ensure reliable communication
 Messages must be properly formatted and include all necessary metadata
Global State in Distributed Systems
3.1 Concept of Global State
The global state of a distributed system is the collective state of all processes and communication
channels.
Used in checkpointing, debugging, and deadlock detection.
Challenges
No global clock: Processes operate asynchronously.
Inconsistent views: Different observers might see different states.
Message in transit: A message sent but not yet received is in an intermediate state.
Chandy-Lamport Algorithm (Snapshot Algorithm)
A method to record consistent global states in an asynchronous system.
Steps
A process takes a local snapshot and sends marker messages.
Upon receiving a marker, processes take snapshots of their states.
Collect all local snapshots to construct a global state.
Diagram: Capturing Global State
P1: A → B → C (Snapshot at B)
P2: D → E → F (Snapshot at E)
P3: G → H → I (Snapshot at H)
A consistent global snapshot includes events before markers.
Capturing Consistent Global State
I've created a diagram illustrating the process of capturing a consistent global state across three
processes (P1, P2, and P3) using the Chandy-Lamport snapshot algorithm.
In this scenario:
•P1 takes a local snapshot at event B
•P2 takes a local snapshot at event E
•P3 takes a local snapshot at event H
The diagram shows:
Local Events: Each process has its sequence of events (A→B→C for P1, D→E→F for P2,
G→H→I for P3)
Marker Messages: After each process records its local state, it sends marker messages to all other
processes to coordinate the global snapshot
Consistent Global Snapshot: The green highlighted area shows the consistent global snapshot that
includes:
•P1's state after event B
•P2's state after event E
•P3's state after event H
Events Not Captured: The red highlighted area shows events that occur after the snapshot is
taken (C, F, and I)
This global snapshot is consistent because:
 It captures a possible execution state of the system
 For any event included in the snapshot, all causally preceding events are also included
 The marker messages ensure that in-transit messages are properly accounted for
 The Chandy-Lamport algorithm guarantees that this snapshot represents a valid global state
that could have occurred during the execution of the distributed system, even though the
local snapshots were not taken simultaneously.

You might also like