0% found this document useful (0 votes)
14 views21 pages

DC 2marks

Uploaded by

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

DC 2marks

Uploaded by

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

PART A (2 MARKS)

UNIT 1

1.1 Draw and explain a simple architecture of a message-passing system.

Ans: A message-passing system consists of two primary components:


Processes: Independent entities that communicate with each other.
Communication Channels: Mediums for exchanging messages.
Diagram:
A simple architecture has processes (P1, P2) connected via a logical channel.
Messages are sent using "send" and "receive" primitives.

Explanation:
Processes interact by passing messages through the channel. These messages
can be synchronous (blocking) or asynchronous (non-blocking). Communication
ensures coordination in distributed systems.

1.2 Justify the importance of middleware in a distributed system.

Ans: Middleware provides a layer of abstraction between applications and


operating systems, offering:
Communication Management: Simplifies message-passing and data exchange.
Interoperability: Enables communication across heterogeneous platforms.
Scalability: Supports system expansion without significant redesign.
Middleware ensures seamless interaction in distributed systems by managing
complexity.
1.3 Compare message-passing models and shared memory models in terms of
communication.

Ans: Communication Mechanism:


• Message-Passing Models: Processes communicate by explicitly sending
and receiving messages. This requires coordination and well-defined
protocols.
• Shared Memory Models: Processes communicate by directly accessing a
shared memory space. Data is shared implicitly without explicit
send/receive operations.
Overhead:
• Message-Passing Models: Involves higher communication overhead due
to message construction, transmission, and synchronization between
processes.
• Shared Memory Models: Lower overhead since processes directly read
and write from the shared memory, avoiding data copying.
Scalability:
• Message-Passing Models: Scales better in distributed systems since
processes do not depend on a central shared memory.
• Shared Memory Models: Limited scalability as all processes rely on
accessing a common memory, which can become a bottleneck with
increased processes.

1.4 Provide an example of a real-world application that utilizes asynchronous


communication in a distributed system.

Ans: Example: Email Systems


Email clients send messages asynchronously. The recipient retrieves messages
later, ensuring non-blocking communication.
Other examples include messaging queues like RabbitMQ or Kafka, used in
microservices.
1.5 Classify the different models of distributed execution based on their
communication methods. Provide examples for each category.

Ans:
• Message-Passing Model: Processes communicate by exchanging
messages. Example: MPI (Message Passing Interface).
• Shared Memory Model: Processes interact through a shared address
space. Example: Distributed Shared Memory (DSM) systems.
• Hybrid Model: Combines message passing and shared memory. Example:
NUMA (Non-Uniform Memory Access) systems.

1.6 What strategies would you recommend for ensuring data consistency in a
distributed database system? Discuss the trade-offs involved (2 marks)

Ans:
Replication with Consensus Protocols (e.g., Raft, Paxos): Ensures consistent
data across nodes.
Eventual Consistency: Relaxed consistency for better availability (CAP theorem).
Trade-offs:
Strong Consistency: High latency and lower availability.
Eventual Consistency: Faster responses but potential temporary inconsistency.

1.7 Create a diagram showing the global state of a distributed system with
three nodes.

Ans: To answer, draw three nodes (A, B, C) in a distributed system connected


via communication links. Label each node with its local state and show
message exchanges with arrows to indicate event dependencies.
1.8 Why are design issues and challenges critical to the development of
distributed systems?

Ans: Fault tolerance: Ensuring the system continues operating despite failures.
Scalability: Supporting growth in users or resources without performance
degradation.
Synchronization: Maintaining consistency across distributed components.
Security: Protecting data and communications in a decentralized environment.
Resource management: Efficient allocation of distributed resources.

1.9 Compare synchronous and asynchronous executions in distributed systems.

Ans: Synchronous execution: Processes operate in a tightly synchronized


manner, ensuring a predictable order of operations but require constant
communication.
Asynchronous execution: Processes work independently without waiting for
each other, offering flexibility but increasing complexity in managing
consistency.

1.10 Describe an application scenario where using a distributed file system


would be useful.

Ans: A content delivery network (CDN) that distributes media content (like
videos or images) to multiple servers worldwide. Distributed file systems
ensure high availability and faster access to content for users across regions.

1.11 List the fundamental operations for communication in distributed systems.

Ans:
• Send: Transmitting messages from one process to another.
• Receive: Accepting and processing incoming messages.
• Multicast: Sending messages to multiple processes simultaneously.
• Synchronize: Maintaining consistency and ordering across
communications.

1.12 Which strategies would you suggest for handling failures in a distributed
system?

Ans:
• Replication: Duplicating data or services to ensure availability.
• Checkpointing: Regularly saving system state to recover after a failure.
• Timeouts and retries: Detecting failure and attempting recovery.
• Failover mechanisms: Redirecting workloads to backup systems.

UNIT 2

2.1 Sketch the concept of the happens-before relation in a distributed system


and explain the message flow.

Ans:
Diagram: A timeline of events in two processes (P1, P2) connected via
messages.
Explanation:
The happens-before (→) relation defines causal ordering:
• If A → B, then A causally precedes B.
• Applied via logical clocks, ensuring consistent event ordering.

2.2 Justify the use of vector clocks over scalar clocks in detecting causal
relationships.
Ans: Vector clocks provide precise causality by maintaining:
• A vector of timestamps for each process.
• The ability to detect concurrent events (unlike scalar clocks).
They overcome the limitation of scalar clocks, which only ensure partial
ordering.

2.3 Compare the Chandy-Lamport algorithm with other snapshot algorithms.

Ans:
Basic Principle:
• Chandy-Lamport Algorithm: Uses marker messages to record the global
state in a distributed system. The algorithm ensures a consistent
snapshot by recording the states of processes and communication
channels without halting the system.
• Other Snapshot Algorithms: Some algorithms, such as synchronous
snapshots, may require processes to pause operations or rely on
centralized coordination to collect states, which can disrupt system
performance.
Assumptions:
• Chandy-Lamport Algorithm: Assumes a FIFO ordering of messages in
communication channels and that processes are connected by reliable
channels.
• Other Snapshot Algorithms: Algorithms like Mattern’s algorithm do not
rely on FIFO ordering and instead use vector clocks to record causal
relationships, which can handle more general scenarios but may incur
higher complexity.
Efficiency:
• Chandy-Lamport Algorithm: Highly efficient for systems that meet its
assumptions, as it minimizes overhead by using marker messages only
once per channel.
• Other Snapshot Algorithms: Algorithms that use vector clocks or
centralized logging may have greater time and space complexity due to
additional metadata or synchronization requirements.

2.4 How can synchronous program order help in debugging distributed


applications?

Ans: Synchronous order ensures sequential execution, making it easier to:


• Reproduce bugs reliably.
• Track dependencies between processes.
• This simplifies identifying race conditions and communication issue.

2.5 Outline the process of message delivery using FIFO channels in a


distributed system.

Ans:
• Message Ordering: Ensure messages from one sender are received in the
same order.
• Implementation: Use sequence numbers to track messages.
• Delivery: The receiver processes messages in order of sequence
numbers.

2.6 What strategy would you employ to minimize the overhead of snapshot
recording in a high-traffic distributed system?

Ans:
• Incremental Snapshots: Record changes since the last snapshot.
• Sampling: Snapshot only critical data or high-priority events.
• Asynchronous Recording: Avoid halting processes during snapshots.
These reduce resource usage while maintaining consistency.
2.7 Create a diagram that shows the "happens-before" relationship among
events in a distributed system.

Ans: To answer, draw nodes (A, B, C) and show events on each timeline. Use
arrows to indicate causal relationships (e.g., A1 → B2 if A1 sends a message
received by B2).

2.8 Why is the Chandy-Lamport algorithm important for capturing a consistent


global state?

Ans: The algorithm allows a consistent snapshot of a distributed system


without pausing processes. It ensures that all recorded states and messages
reflect a coherent point in time, enabling fault tolerance and debugging.

2.9 Compare scalar time and vector clocks in terms of how they manage event
ordering.

Ans:
Scalar time: Assigns a single logical clock to each event, easy to implement but
cannot detect causality.
Vector clocks: Uses an array of clocks for precise causality tracking but is more
complex to manage.

2.10 In what scenarios would causal order message delivery be preferred over
total order delivery?

Ans: Causal order is preferred when:


Causality matters: Ensuring dependent messages (e.g., Update A followed by
Notify) are received in order.
Lower overhead: Avoiding global synchronization required by total order.
2.11 How does total order communication differ from causal order
communication?

Ans: Total order: All processes agree on the same message sequence, ensuring
global consistency but with high overhead.
Causal order: Maintains the "happens-before" relationship, focusing on
dependencies rather than global sequence.

2.12 Analyze the implications of not using global timestamps in a distributed


system.

Ans: Without global timestamps:


• Inconsistency: Events may be processed out of order.
• Conflict resolution issues: Harder to resolve updates in concurrent
operations.
• Dependency tracking: Requires alternative mechanisms like vector
clocks.

UNIT 3

3.1 Process Flow of Ricart-Agrawala Algorithm

Ans: The Ricart-Agrawala algorithm is a message-passing protocol for achieving


distributed mutual exclusion. The process flow involves:
• A node sends a Request message to all other nodes when it wants to
enter the critical section (CS), including a timestamp.
• Each node responds with a Reply message unless:
It is in its own CS or It has a higher-priority request (based on
timestamps).
• The requesting node enters the CS only after receiving replies from all
nodes.
• On leaving the CS, it sends Release messages to allow waiting nodes to
proceed.

3.2 Role of Response Time in Distributed Systems

Ans: Response time refers to the delay between a request being sent and its
corresponding reply being received. It significantly affects:
• System Performance: Higher response times can lead to bottlenecks and
reduced throughput.
• User Experience: Applications requiring real-time processing suffer if
response times are high.
• Resource Utilization: A delayed response may cause resources to be held
unnecessarily, impacting efficiency.

3.3 Comparison of Physical Clocks and Logical Clocks

Ans:
Definition:
• Physical Clocks: Measure real-world time based on actual physical
standards like UTC.
• Logical Clocks: Provide an abstract notion of time to maintain the order
of events in distributed systems.
Purpose:
• Physical Clocks: Synchronize system time across machines.
• Logical Clocks: Ensure event ordering and causality in the absence of
synchronized physical clocks.

3.4 Situations for Non-Token-Based Distributed Mutual Exclusion


Ans: Non-token-based approaches are preferred when:
• High Fault Tolerance is Required: Losing a token in token-based systems
causes delays, while non-token-based systems rely on dynamic requests
and responses.
• Small Systems: They are simpler to implement for a limited number of
nodes.
• Low Message Overhead is Tolerable: Since they require more message
exchanges, they work better in less time-critical environments.

3.5 Clock Synchronization in Distributed Systems

Ans: Clock synchronization ensures that events occurring across distributed


systems can be ordered consistently.
Two Limitations of Logical Clocks:
• They do not maintain real-time accuracy, only relative event ordering.
• They cannot detect absolute drift or time discrepancies across systems.

3.6 Strategy for Achieving Fault Tolerance in Distributed Systems

Ans: To achieve fault tolerance:


• Redundancy: Use multiple nodes for the same task to avoid single points
of failure.
• Replication: Maintain copies of critical data across nodes.
• Consensus Protocols: Implement protocols like Paxos or Raft to maintain
consistency during failures.
• Checkpointing: Periodically save system states to recover quickly after
failures.

3.7 Draw and explain the structure of a wait-for graph used for deadlock
detection in distributed systems.
Ans:
Structure: A wait-for graph is a directed graph where:
Nodes represent processes.
Directed edges (P1 → P2) indicate that process P1 is waiting for process P2 to
release a resource.
Explanation:
If the graph contains a cycle, it indicates a deadlock situation.
Deadlock detection involves periodically constructing and analyzing the graph
for cycles.

3.8 Justify why all four conditions (mutual exclusion, no preemption, hold and
wait, and circular wait) are necessary for a deadlock to occur.

Ans:
• Mutual Exclusion: At least one resource must be non-shareable.
• No Preemption: Resources cannot be forcibly taken away from a process.
• Hold and Wait: A process holding resources can request additional
resources.
• Circular Wait: A circular chain of processes exists where each process
waits for a resource held by the next process in the chain.
All these conditions must occur simultaneously for a deadlock to arise.

3.9 Compare token-based and quorum-based approaches for distributed


mutual exclusion.

Ans:
Mechanism:
• Token-Based: A unique token is passed among processes; possession of
the token grants access to the critical section.
• Quorum-Based: A process must obtain permission from a majority
(quorum) of processes to enter the critical section.
Overhead:
• Token-Based: Low message overhead; requires only token transfer unless
the token is lost.
• Quorum-Based: Higher message overhead due to multiple permission
requests and replies.

3.10 How would you use the REQUEST and REPLY messages in the Ricart-
Agrawala algorithm to ensure mutual exclusion in a system with three
processes?

Ans:
REQUEST Message: A process sends a timestamped REQUEST to all other
processes when it wants to enter its critical section.
REPLY Message: Each process sends a REPLY when it receives a REQUEST,
provided it is not currently in or waiting for its own critical section.
Mutual exclusion is achieved because a process enters its critical section only
after receiving REPLY messages from all other processes.

3.11 What are the merits and limitations of using token-based algorithms for
mutual exclusion?

Ans:
Merits:
• Low message complexity (only one token is exchanged).
• No need for timestamps or message ordering.
Limitations:
• Token loss can disrupt the system, requiring recovery mechanisms.
• A single point of failure if token loss occurs.
3.12 How would you strategically design a system to ensure fair access to
critical sections in a distributed environment?

Ans:
• Use timestamped requests to ensure processes are served in the order
of their requests.
• Implement algorithms like Ricart-Agrawala or Lamport’s algorithm for
fairness.
• Include priority mechanisms to prevent starvation.
• Periodically review and resolve any delayed or lost requests.

UNIT 4

4.1 Diagram of Two-Phase Commit Protocol


The Two-Phase Commit Protocol (2PC) ensures atomicity across distributed
systems. It consists of two main phases:

Ans:
• Prepare Phase:
The coordinator sends a "Prepare to commit?" request to all
participants.
Each participant responds with a "Yes" if ready or "No" if not ready.
• Commit Phase:
If all participants vote "Yes," the coordinator sends a "Commit" message.
If any participant votes "No," the coordinator sends a "Rollback"
message.
Coordinator Participant 1 Participant 2
|------Prepare-------->| |
|<------Yes/No---------| |
|------------Commit/Rollback----------->|
4.2 Distributed Debugging

Ans: Distributed debugging involves identifying and fixing bugs in distributed


systems. These systems involve multiple processes running on different
machines, making debugging complex due to issues like race conditions,
synchronization problems, and inconsistent states. Techniques used include:
Log Analysis: Tracking events across nodes.
Global Breakpoints: Pausing processes simultaneously to analyze system state.
Tracing Tools: Tools like Jaeger or Zipkin for analyzing inter-process
communication.

4.3 Coordinated Checkpointing vs. Asynchronous Checkpointing

Ans:
Coordinated Checkpointing:
• Advantages: Ensures a consistent global state, simplifies recovery.
• Disadvantages: High overhead due to synchronization among all
processes.
Asynchronous Checkpointing:
• Advantages: Non-blocking, allowing processes to continue execution.
• Disadvantages: Risk of inconsistent checkpoints, leading to cascading
rollbacks.

4.4 Applications of Consensus Algorithms

Ans: Consensus algorithms enable agreement among distributed systems.


Practical applications include:
• Blockchain: Validating transactions and maintaining integrity.
• Distributed Databases: Leader election and ensuring consistent replicas.
• Fault-Tolerant Systems: Ensuring state synchronization in clusters like
Kubernetes and Apache Kafka.

4.5 Issues in Failure Recovery during Checkpointing

Ans: Challenges faced in failure recovery during checkpointing include:


• Inter-Process Dependencies: Restoring consistent states across
interdependent processes.
• Storage Overhead: Managing large checkpoint files.
• Recovery Time: Delays in retrieving and replaying checkpoints.

4.6 Strategies to Enhance Rollback Recovery

Ans:
Logging Events: Maintain a log of changes after each checkpoint to minimize
rollback effort.
Incremental Checkpointing: Save only the changes since the last checkpoint to
reduce storage.
Replication: Use redundant nodes to avoid complete rollbacks.

4.7 Illustrate the process of checkpointing in a distributed system.

Ans: Checkpointing involves saving the current state of a process to stable


storage periodically. In distributed systems, this ensures system recovery by
rolling back to a consistent global state if a failure occurs.

4.8 What do you mean by clock skew and clock drift?


Ans: Clock skew refers to the difference in time between clocks in different
nodes of a distributed system. Clock drift is the gradual divergence of a clock
from the actual time due to hardware differences.

4.9 Compare agreement in synchronous systems with failures versus


agreement in failure-free systems.

Ans: In synchronous systems with failures, agreement is harder due to potential


node crashes or message losses. In failure-free systems, agreement is simpler
as all nodes are operational and reliable communication is assumed.

4.10 How is checkpoint-based recovery implemented in a distributed system?

Ans: Checkpoint-based recovery saves periodic snapshots of process states.


Upon failure, the system rolls back to the last consistent checkpoint,
reconstructing the state across all processes to resume execution.

4.11 Define consensus and agreement algorithms in the context of distributed


computing.

Ans: Consensus algorithms ensure all nodes agree on a single value, crucial for
consistency in distributed systems. Agreement algorithms resolve differences in
replicated data or decision-making across nodes.

4.12 When is an object considered to be garbage?

Ans: An object is considered garbage if it is no longer accessible or referenced


by the program, meaning it cannot be used or reached by any active process.
UNIT 5

5.1 Cloud Service Model Architecture

Ans: The cloud service model consists of three layers:


• Infrastructure as a Service (IaaS): Provides virtualized resources (e.g.,
virtual machines, storage).
• Platform as a Service (PaaS): Offers development platforms with tools
and APIs.
• Software as a Service (SaaS): Provides end-user applications hosted in
the cloud (e.g., Gmail).

Diagram:
+-------------------+
| SaaS (Apps) |
+-------------------+
| PaaS (Tools) |
+-------------------+
| IaaS (Infrastructure) |
+-------------------+

5.2 Driving Factors and Challenges of Cloud Adoption

Ans: Driving Factors:


• Scalability: Ability to grow resources on demand.
• Cost Efficiency: Pay-as-you-go pricing reduces capital expenditure.
• Accessibility: Access from any location with an internet connection.
Challenges:
• Security Concerns: Protecting sensitive data.
• Vendor Lock-In: Dependency on specific cloud providers.
• Latency: Delays due to network dependencies.

5.3 Scalability vs. Elasticity in Cloud Computing

Ans:
Scalability: Adds more resources to handle increasing workloads. Example:
Adding servers to a cluster.
Elasticity: Dynamically adjusts resources based on demand. Example: Scaling up
during peak hours and scaling down during off-peak hours.

5.4 Load Balancing in Cloud Services

Ans: Load balancing distributes incoming network traffic across multiple


servers.
Techniques:
Round Robin: Assigns requests in a circular manner.
Resource-Based Allocation: Routes traffic based on server performance
metrics.
Tools: AWS Elastic Load Balancer, Nginx.

5.5 Merits and Limitations of Cloud Storage

Ans:
Merits:
• Scalability: Adjust storage as needed.
• Accessibility: Access from anywhere.
• Cost Efficiency: Pay for what you use.
Limitations:
• Security Risks: Vulnerability to breaches.
• Dependency on Internet: Limited functionality offline.

5.6 Replication in Cloud Computing

Ans: Replication involves copying data across servers for redundancy.


Benefits:
• Enhances reliability by ensuring data is available even if one server fails.
• Increases read performance by allowing multiple servers to serve
requests.

5.7 Draw a diagram to illustrate the different cloud deployment models.

Ans:
Public Cloud
Private Cloud
Hybrid Cloud
Community Cloud)

5.8 What do you mean by cloud computing, and what are its primary
characteristics?

Ans: Cloud computing delivers services (storage, processing, etc.) over the
internet. Characteristics include scalability, pay-as-you-go pricing, resource
pooling, and on-demand self-service.
5.9 Compare the different cloud service models: IaaS, PaaS, and SaaS.

Ans:
IaaS (Infrastructure as a Service): Provides virtualized hardware (e.g., AWS EC2).
PaaS (Platform as a Service): Offers development platforms (e.g., Google App
Engine).
SaaS (Software as a Service): Delivers applications (e.g., Google Workspace).

5.10 How is virtualization used in cloud computing to optimize resource


utilization?

Ans:
• Virtualization enables multiple virtual machines (VMs) to run on a single
physical server, allowing better utilization of hardware resources by
sharing them among multiple users or applications.
• Resources like CPU, memory, and storage are allocated dynamically to
VMs based on demand, ensuring optimal usage and reducing wastage of
idle resources.

5.11 Define cloud computing and list its key characteristics.

Ans: Cloud computing refers to delivering computing services (storage,


processing) via the internet. Key characteristics include elasticity, scalability,
resource pooling, and service on demand.

5.12 What strategies can organizations adopt to effectively monitor cloud


services and ensure performance?
Ans: Organizations can use monitoring tools like CloudWatch, define
performance metrics, automate alerts, conduct regular audits, and optimize
resource allocations.

You might also like