DC Iat
DC Iat
• Synchronous Communication:
• Asynchronous Communication:
• Buffering Strategy: Requires buffers to temporarily store messages until the receiver
is ready to process them.
• Shared memory systems provide a common memory space that multiple processes can
access and communicate through. This enables inter-process communication by reading and
writing to shared variables or memory locations, ensuring synchronization and data
consistency.
• Scalar Time: Uses a single counter (logical clock) to assign timestamps to events, ensuring a
partial order of events in a distributed system.
• Vector Time: Uses a vector of counters, one for each process, to track the causal relationship
between events and establish a more detailed order of events in distributed systems.
4. Relationship Between Independent Events e1 and e2 of Two Processes Occurring at the Same
Time (AU 2023)
• Resource Sharing: Allows access to distributed resources such as databases, files, and
processing power.
• Reliability and Fault Tolerance: Distributed systems can provide redundancy and failover
mechanisms.
7. What is Middleware?
• The snapshot recording algorithm captures a consistent global state of a distributed system.
It is used for debugging, recovery, and analysis purposes, ensuring that all processes' states
and message channels are recorded at a specific instance without halting the system.
• Total order execution means that all processes in a distributed system agree on the same
sequence of events or message delivery order, ensuring consistency and synchronization
across the system.
• Event Comparison: Two vector timestamps can be compared to determine whether events
are causally related, concurrent, or ordered.
• Size: The vector time grows in size with the number of processes in the system. Each process
maintains a vector with entries for all processes.
PART C
10)b)Three-phase distributed algorithm for enforcing total and causal order of messages in
distributed systems.
In distributed systems, ensuring both total order and causal order for messages exchanged between
processes is critical for maintaining consistency and correctness. The three-phase distributed
algorithm is designed to enforce these message orders in a closed group of processes, ensuring that
all processes in the group receive messages in the same sequence (total order) and respect cause-
effect relationships (causal order).
Key Concepts:
• Total Order: All messages are received in the same order by all processes, regardless of when
and from where they were sent.
• Causal Order: Messages that are causally related (i.e., one message influences or depends
on another) are received in the correct cause-and-effect order.
The algorithm operates in three distinct phases, where messages are assigned timestamps, these
timestamps are negotiated, and a final order is agreed upon by all processes. The goal is to establish
a consistent message delivery sequence that adheres to both total and causal ordering rules.
• The message is tagged with a locally unique identifier (a message ID) and a tentative
timestamp (based on the sender's local clock).
• The timestamp reflects the sender's current logical or physical time and helps establish an
initial ordering of the message.
• Upon receiving the message, each process checks the timestamp in the message and
compares it with its own local time.
• Each process generates a tentative timestamp for the message, ensuring that its timestamp
reflects the current state of the process.
• This timestamp is typically the greater of the received timestamp and the process’s current
clock time (incremented).
• The receivers then send their proposed timestamp back to the sender.
• The sender waits to receive tentative timestamps from all group members before proceeding
to the next phase.
• Once the sender receives all proposed timestamps, it computes the maximum of all
proposed timestamps. This maximum timestamp becomes the final timestamp for the
message.
• The sender then multicasts this final timestamp to all group members, confirming the
delivery order.
• Each process, upon receiving the final timestamp, can now mark the message
as deliverable and deliver it in the agreed order.
Operations of the Algorithm:
1. Sender’s Role:
• Multicast Message: The sender initiates the communication by sending a message with its
local timestamp.
• Final Timestamp Assignment: The sender computes the highest proposed timestamp and
multicasts the final timestamp to all receivers, ensuring that the message is delivered in the
same order across all processes.
2. Receiver’s Role:
• Propose Tentative Timestamp: Upon receiving the message, the receiver checks its local
clock and proposes a timestamp. The proposed timestamp ensures that messages are
processed in causal order.
• Wait for Final Timestamp: After sending the tentative timestamp, the receiver waits for the
final timestamp from the sender.
• Deliver Message: Once the final timestamp is received, the message is marked deliverable,
and the receiver delivers the message in the proper order.
Consider a distributed system with four processes: P1, P2, P3, and P4. Each process follows the
three-phase distributed algorithm to ensure total and causal message order.
Scenario:
• P2 receives M1 and proposes a new timestamp of 6 (its local clock is 5, and it increments it
to 6).
• P3 and P4 also receive M1 and propose timestamps of 9 (their clocks are ahead).
• P2 collects the timestamps for M2: 9 (from P3) and 10 (from P4). The final timestamp is 10.
Message Delivery:
• M1 with the final timestamp of 9 is delivered before M2 (timestamp 10), ensuring total
order.
• The causal order is respected because P2's proposal for M1 considered its local clock and
updated it before sending M2.
• Total Order: All processes deliver messages in the same final order determined by the final
timestamps. In the example, M1 is delivered before M2 across all processes.
• Causal Order: Causal relationships between messages are respected. For example,
if M1 caused M2, the algorithm guarantees that M1 will always be delivered before M2.
1. Consistency Across Processes: Ensures that all processes deliver messages in the same order,
which is crucial in applications like banking systems where the order of transactions must be
consistent across all branches.
3. Fault Tolerance: Even if some messages are delayed or received out of order, the algorithm
ensures that the final delivery order remains consistent, making it suitable for distributed
systems with unreliable networks.
1. Distributed Databases:
• Tools like shared document editing (e.g., Google Docs or Microsoft Teams) require
that changes made by users are processed in the same order for all participants. The
three-phase algorithm ensures consistent ordering of edits and updates.
Conclusion:
The three-phase distributed algorithm is essential for enforcing both total and causal order in
message delivery across distributed systems. Its ability to guarantee consistent message ordering
makes it a fundamental approach for ensuring the reliability and correctness of distributed
applications like banking systems, multiplayer games, and collaborative tools. By using tentative
timestamps and negotiating final timestamps, the algorithm ensures that all processes receive
messages in the same sequence, respecting causal dependencies and maintaining system-wide
consistency.
Reliability in distributed systems can be broken down into three main aspects:
1. Availability
• This refers to the system's ability to be operational and accessible when needed.
2. Integrity
• This ensures that the system's data remains accurate and consistent, even in the
face of concurrent access or system failures.
• Data integrity guarantees that unauthorized access or errors do not corrupt the
information stored and processed by the system.
3. Fault Tolerance
• Fault tolerance is the system's ability to continue functioning correctly even when
parts of the system fail.
Yes, the importance of these aspects can vary depending on the application. Different systems
prioritize reliability aspects differently based on their specific use cases. Below are examples of
applications where each aspect is more critical than the others:
• Prioritization:
• Fault Tolerance: The system should continue working even if some components fail
(e.g., one server going down should not crash the entire site).
• Prioritization:
• Fault Tolerance: The system must ensure that operations continue even in the
event of hardware or software failures, but availability can be secondary as long as
no data corruption occurs.
• Justification: In critical systems like air traffic control, fault tolerance is the top priority.
Even in the event of hardware failures or power outages, the system must continue
functioning to ensure safety.
• Prioritization:
• Fault Tolerance (highest priority): The system must continue to operate seamlessly,
ensuring that no critical operations are interrupted.
• Availability: The system must always be accessible, but its ability to withstand
failures (fault tolerance) is what keeps it running.
• Integrity (lower priority): Though important, minor data delays or temporary
inconsistencies can be tolerated as long as the system remains operational.
Conclusion:
The order of importance for the three aspects of reliability—availability, integrity, and fault
tolerance—depends on the application's requirements. For example, e-commerce platforms
prioritize availability, financial systems emphasize data integrity, and safety-critical systems like air
traffic control require fault tolerance as their top concern. By understanding the specific demands
of each application, system designers can allocate resources and design their architectures to
prioritize the most critical aspect of reliability.
PART B
Definition:
• FIFO (First In, First Out) message queue refers to a method of processing where the first
message or transaction sent into the queue is the first one to be processed. It maintains
the sequence of messages, which is critical in systems requiring ordered message delivery.
• Scenario:
• In the banking example, each customer request (message) is placed into a FIFO
queue. The first request (say a deposit) is processed first, followed by the next one
(say a withdrawal).
• In IoT applications, sensor data is often time-sensitive. A FIFO queue ensures that
the oldest sensor data is processed first, ensuring that time-dependent data is
handled in sequence.
Advantages of FIFO:
• Ordered Message Delivery: Ensures the system processes requests in the exact order they
are sent, preventing data inconsistencies.
• Predictability: Ensures fairness, as each message is processed in the same order it was
received.
Disadvantages:
• No Priority Handling: FIFO does not prioritize urgent tasks, meaning all tasks are treated
equally, regardless of importance.
Definition:
How It Works:
The algorithm relies on markers to distinguish which messages to include in the snapshot and
ensures that no message is missed during the recording of the system state.
• One process initiates the snapshot by recording its local state (e.g., the balance of
an account in a banking system).
• After recording its state, the process sends a marker along all of its outgoing
channels to notify other processes that it is taking a snapshot.
• The process continues to send and receive messages after the marker is sent.
• When another process receives the marker for the first time:
• If the process receives another marker on a different channel after recording its
state, it only records the messages received between the local state recording and
the marker arrival.
• For each channel, the algorithm ensures that only messages sent before the
marker was sent are recorded in the snapshot. Messages sent after the marker are
excluded.
Example:
• P1 starts a snapshot and records its current state (account balance). It then sends
a marker to P2.
• P2 receives the marker, records its balance, and marks its incoming channel as empty.
• Any messages sent between P1 and P2 before the marker are included in the snapshot, but
those sent after the marker are excluded.
• When a process initiates the snapshot, it records its current local state (e.g.,
account balance in banking).
2. Sending Markers:
• The process sends markers to all outgoing channels to inform other processes of
the snapshot.
• For each incoming channel, the process waits until it receives a marker. Until the
marker is received, all incoming messages on that channel are considered part of
the state. After receiving the marker, the process considers the channel state as
empty.
4. Termination:
• The snapshot is complete when all processes have recorded their local states and
received a marker on each incoming channel.
• Non-intrusive: The system does not need to be paused or stopped for the snapshot to be
taken.
Disadvantages:
• Communication Overhead: Sending markers along every channel may create additional
overhead in high-communication systems.
• Delayed Snapshot: If channels are slow, the snapshot process may take longer to complete.
In a distributed database system, a snapshot algorithm can be used to ensure consistent backups.
For example, a snapshot could record the current state of all account balances in a banking system.
If one server crashes, the snapshot provides a consistent view of all transactions at the moment
before the crash, ensuring that no data is lost or duplicated.
Conclusion:
In systems where message order is crucial, like in banking, the FIFO message queue ensures that
transactions are processed in the correct sequence. The Chandy-Lamport Snapshot
Algorithm effectively records the global state in distributed systems by using markers and works
efficiently in FIFO channels. Together, FIFO queues and snapshot algorithms maintain consistency,
integrity, and reliability in distributed computing environments.
Definition:
Key Features:
Disadvantages:
Definition:
• Decoupling of Components: Sender and receiver need not interact directly, enabling
flexibility in system design.
• Reliability: Ensures that messages are delivered reliably even in case of failures.
• Mechanism:
• Messages are sent from one sender to one receiver through a queue.
• The sender pushes the message into the queue, and the receiver retrieves it.
• Example:
• ActiveMQ, RabbitMQ.
• Use Case:
• A ticket booking system where each request (message) is processed exactly once.
Advantages:
Disadvantages:
• Mechanism:
• Messages are published to topics, and multiple subscribers receive messages from
the topic.
• Example:
• Use Case:
• Newsfeed systems where multiple users subscribe to a topic and receive updates.
Advantages:
Disadvantages:
• Fault Tolerance: By using message queues and topics, MOM can manage failed components
without losing data, as messages are stored and resent when the system is restored.
Example of MOM:
• When a customer places an order (message), it goes to an order processing queue (Point-to-
Point model).
• After processing, a notification service (using Pub/Sub) sends order status updates to all
subscribers (warehouse, customer, delivery team).
Conclusion: