Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
27 views32 pages

Ds Pyqs

The document discusses various aspects of distributed systems, including definitions, inter-process communication, desirable features, and remote procedure calls. It also covers distributed file systems, the differences between network and distributed operating systems, and the requirements and design issues of distributed file systems. Additionally, it addresses routing overlays, distributed debugging, mutual exclusion, and the differences between the agreement and consensus problems.
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)
27 views32 pages

Ds Pyqs

The document discusses various aspects of distributed systems, including definitions, inter-process communication, desirable features, and remote procedure calls. It also covers distributed file systems, the differences between network and distributed operating systems, and the requirements and design issues of distributed file systems. Additionally, it addresses routing overlays, distributed debugging, mutual exclusion, and the differences between the agreement and consensus problems.
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/ 32

Answers to Q.

1 (a, b, c, d)
(a) What is Distributed System?
A distributed system is a collection of independent computers that appear to users as a single
coherent system. These systems work together to achieve a common goal by communicating
over a network.

(b) Define Inter-process Communication (IPC).


Inter-process communication (IPC) refers to mechanisms that allow processes running on
different or the same machines to communicate and coordinate actions. IPC mechanisms
include message passing, shared memory, sockets, and remote procedure calls (RPC).

(c) Discuss the desirable features of a good distributed system.


1. Transparency:
– Access Transparency: Users should not worry about the physical location of
resources.
– Location Transparency: Users access resources without knowing their locations.
– Replication Transparency: Users are unaware of data replication.
– Concurrency Transparency: Multiple users can access resources simultaneously
without conflict.
2. Scalability:
– The system can handle an increasing number of nodes or workloads efficiently.
3. Fault Tolerance:
– The system continues to operate correctly despite failures.
4. Resource Sharing:
– Distributed systems provide shared access to hardware, software, and data
resources.
5. Performance:
– High performance is achieved by distributing workloads across multiple nodes.
6. Security:
– Ensures secure access to resources and protects communication.

(d) Explain the Remote Procedure Call (RPC) mechanism with various functional
components.
RPC is a communication mechanism that allows a program to execute a procedure on a remote
system as if it were local.

Components of RPC Mechanism:

1. Client Stub:
– The client-side representation of the procedure that marshals arguments into a
message to send to the server.
2. Server Stub:
– Receives the request on the server-side, unpacks the arguments, and invokes the
appropriate procedure.
3. Communication Module:
– Handles message transmission between the client and server.
4. Dispatcher:
– Maps the received request to the correct procedure on the server.
5. Binding:
– Establishes the connection between the client and server before communication.

Steps of RPC Mechanism:

1. The client invokes the remote procedure via the client stub.
2. The client stub marshals the request into a message and sends it to the server.
3. The server stub unpacks the message and executes the procedure.
4. Results are marshaled back into a message and sent to the client.
5. The client stub unpacks the result and provides it to the client.

OR: Discuss the relative advantages and disadvantages of commonly


used models for configuring distributed computing systems.
Models:
1. Client-Server Model:
– Advantages:
• Centralized control.
• Easy to maintain and manage.
– Disadvantages:
• Single point of failure.
• Scalability issues under heavy load.
2. Peer-to-Peer (P2P) Model:
– Advantages:
• No central point of failure.
• Highly scalable.
– Disadvantages:
• Complex to manage.
• Security vulnerabilities.
3. Three-Tier Model:
– Advantages:
• Separation of concerns (presentation, logic, and data tiers).
• Improved scalability.
– Disadvantages:
• Higher latency due to multiple layers.
• Complexity in management.
4. Hybrid Models:
– Combines aspects of client-server and P2P for flexibility.
– Advantages: Balances scalability and central control.
– Disadvantages: Increased system complexity.

Future Popularity Prediction:


The Peer-to-Peer model is expected to dominate due to its scalability and fault tolerance.
However, hybrid models that adapt P2P for specific needs may gain traction in diverse
applications.

If you'd like further details on any part, feel free to ask!

Answers to Q.2 (a, b, c, d)


(a) What is a Distributed File System?
A Distributed File System (DFS) is a file system that allows files to be stored across multiple
servers or nodes in a network while still appearing to users as a single cohesive system. DFS
abstracts the physical location of data, ensuring that users can access files regardless of where
they are physically stored.

Key Features of DFS:

1. Transparency: Hides details like file location, replication, and access mechanisms from
users.
2. Scalability: Can scale by adding more nodes and storage to handle growing data and
users.
3. Fault Tolerance: Provides mechanisms like data replication and redundancy to ensure
availability even in case of failures.
4. Consistency: Ensures that changes to files are synchronized across all replicas.
5. Performance: Distributes load and uses caching to improve access speeds.

(b) Define Processes and Threads.


• Process: A process is an independent program in execution. It has its own memory
space and system resources. Each process executes independently of others, but
may interact with them through inter-process communication (IPC).

• Thread: A thread is the smallest unit of execution within a process. Multiple threads
can exist within a single process, sharing the same memory space but able to
execute independently. Threads are often used to perform tasks concurrently within
a process.
(c) Differentiate between Network OS and Distributed OS.
Aspect Network OS Distributed OS
Definition A network operating system allows A distributed operating system
multiple computers to integrates multiple computers into a
communicate and share resources, unified system where users and
but each system operates applications interact as if they are
independently. running on a single system.
Resource Each machine manages its Resources (CPU, memory, etc.) are
Management resources independently, and the centrally managed across all nodes,
OS provides mechanisms for inter- making them appear as a single
machine communication. system.
Transparency Limited transparency, as each High transparency, making it seem
machine's resources are not fully like a single system to the user, even
abstracted. if resources are distributed.
Fault Tolerance Limited, relies on network High fault tolerance, with distributed
protocols and redundancy at the management and replication
application level. mechanisms to handle failures.
Examples Windows Network, UNIX-based Google’s GFS (Google File System),
networking systems. Hadoop Distributed File System
(HDFS).

(d) What are the requirements of a Distributed File System? Give the design issues
of Distributed File System.
Requirements of a Distributed File System (DFS):

1. Transparency: The system should hide the distribution and replication details from the
user. It should provide access transparency, location transparency, and replication
transparency.
2. Fault Tolerance: The system should handle failures and provide recovery mechanisms,
ensuring data is always accessible even if parts of the system fail.
3. Concurrency Control: Multiple clients may access the same file simultaneously. The DFS
should ensure consistent access to avoid conflicts.
4. Security: Access control should be implemented to ensure that unauthorized users do
not access sensitive data.
5. Scalability: The system should be scalable to accommodate increasing data and user
requests without significant degradation in performance.
6. Performance: Optimizing data access speed and minimizing latency, through
mechanisms like caching and load balancing.
7. Consistency: The system must maintain consistency across replicas and ensure that
updates to files are synchronized properly across different nodes.

Design Issues of DFS:

1. File Replication: Deciding how to replicate files across nodes to ensure fault tolerance
while minimizing overhead.
2. Consistency Models: Choosing the right consistency model (e.g., strong consistency vs.
eventual consistency) depending on the application requirements.
3. Distributed File Access: Ensuring that multiple clients can access and modify files
concurrently without causing conflicts.
4. Fault Tolerance and Recovery: Implementing mechanisms like checkpoints, logs, and
replica consistency to handle node failures.
5. Performance Optimization: Balancing load between nodes, minimizing network traffic,
and using caching effectively.
6. Security: Implementing proper authentication and access control to secure data in a
distributed environment.

OR: Define Distributed Operating System. Discuss its architecture


and characteristics.
Distributed Operating System (DOS) is a system that manages a collection of independent
computers and makes them appear to the user as a single system. It integrates the resources of
all the machines in the network to provide a coherent operating environment.

Architecture of Distributed Operating System:

1. Layered Architecture: The system can be divided into layers where each layer is
responsible for a particular functionality. For example:
– Hardware Layer: Includes the physical machines.
– Operating System Layer: Manages resources like CPU, memory, and I/O.
– Middleware Layer: Provides services like communication, synchronization, and
file management.
2. Client-Server Model: Distributed OS can implement a client-server architecture where
client processes request services from servers.
3. Multitier Architecture: Distributed OS may have multiple tiers for different
functionalities like presentation, application, and data storage.

Characteristics of Distributed Operating System:

1. Transparency: Hides the complexity of the underlying distributed system from users.
– Access Transparency: Users do not need to know the location of resources.
– Failure Transparency: The system should mask faults and continue to provide
services even in the event of failures.
2. Concurrency: Supports concurrent access to resources by multiple processes, ensuring
safe and synchronized access.
3. Scalability: The system should scale seamlessly as new nodes are added, maintaining
performance and fault tolerance.
4. Fault Tolerance: It must recover from hardware or software failures and continue
providing services with minimal disruption.
5. Resource Management: Efficient allocation and management of resources across
distributed nodes, often with the help of scheduling and load balancing.
These answers should provide a comprehensive overview of Q.2 (a, b, c, d). Let me know if you
need any further details!

Answers to Q.3 (a, b, c, d)


(a) What is Routing Overlays?
Routing overlays refer to virtual networks built on top of an existing physical network. These
overlays are created to address specific network management needs, such as efficient routing,
fault tolerance, or improving scalability in distributed systems. Overlay networks use logical
links between nodes instead of physical connections and typically rely on underlying network
protocols to communicate between nodes.

Example of routing overlays:

• Content Delivery Networks (CDNs): Use overlays to deliver content more efficiently by
choosing optimal paths.
• Peer-to-Peer Networks: Use overlays for routing between peers based on logical
connections, independent of the underlying physical network.

Advantages:

• Flexibility: Offers network routing tailored to application needs.


• Fault Tolerance: Routes can be adjusted dynamically if part of the network fails.

Disadvantages:

• Complexity: Managing overlay networks adds an extra layer of complexity.


• Overhead: Extra protocols and management layers can add overhead.

(b) Define Distributed Debugging.


Distributed debugging is the process of diagnosing and correcting errors in a distributed
system, where the system's components are spread across multiple nodes. It involves
identifying bugs that may arise due to network communication, concurrency, or failure in parts
of the system, and involves tracing execution across different nodes and processes.

Challenges of Distributed Debugging:

1. Non-determinism: Due to concurrency, the execution order of operations can vary,


making it difficult to reproduce errors.
2. Communication Latency: Errors might occur due to delays or failures in network
communication, adding difficulty to debugging.
3. Fault Localization: Finding the root cause of the issue can be more complex because
errors could propagate across nodes.

Techniques for Distributed Debugging:

• Trace Collection: Collecting logs or traces from multiple nodes for post-mortem
analysis.
• Snapshot Debugging: Taking consistent snapshots of the system at various points to
analyze the state.
• Remote Debugging: Allowing the debugging of processes running on remote nodes via a
debugger interface.

(c) List the Advantages of Unstructured Overlays.


Unstructured overlays are a type of peer-to-peer overlay network where the nodes are not
arranged in a specific structure or hierarchy. These overlays are more flexible but can be less
efficient in terms of routing.

Advantages:

1. Flexibility: Unstructured overlays do not have strict routing protocols, which makes
them easier to design and adapt to changing network conditions.
2. Scalability: These networks can scale easily, as they do not require centralized control or
predefined structures.
3. Fault Tolerance: If a node fails, other nodes can continue to operate without significant
disruption.
4. Simplicity: Implementation is relatively simple compared to structured overlays like
DHTs (Distributed Hash Tables).
5. Decentralization: There is no central point of control, reducing the risk of a single point
of failure.

Examples:

• Gnutella network.
• Napster (early versions) used unstructured overlays.

(d) What is Distributed Mutual Exclusion? What are the three basic approaches for
implementing Distributed Mutual Exclusion?
Distributed Mutual Exclusion ensures that when multiple processes or nodes in a distributed
system need to access a shared resource, only one process can access it at a time. It prevents
race conditions and ensures data consistency across the system.

Three Basic Approaches for Implementing Distributed Mutual Exclusion:

1. Centralized Approach:
– A single node (usually a coordinator) is responsible for granting permission to
access the shared resource.
– Advantages: Simple to implement.
– Disadvantages: The coordinator can become a bottleneck and a single point of
failure.
2. Token-based Approach:
– A unique token circulates among the nodes. Only the node that holds the token
can access the shared resource.
– Advantages: No need for a central coordinator; reduces the message complexity.
– Disadvantages: If the token is lost, the system can become deadlocked until
recovery.
3. Quorum-based Approach:
– A quorum (a set of nodes) is required to grant access to the shared resource. Each
node must request permission from a majority of nodes in the system.
– Advantages: Can be more fault-tolerant as multiple nodes can grant access.
– Disadvantages: Requires more communication overhead, especially in large
systems.

OR: What are the differences between the Agreement Problem and
the Consensus Problem?
Agreement Problem and Consensus Problem are related to decision-making in distributed
systems, where multiple nodes need to agree on a single value.

1. Agreement Problem:
– The agreement problem is concerned with ensuring that multiple processes in a
distributed system agree on a common decision or value.
– It only ensures that all processes agree on a single value, but it doesn't guarantee
that the value is correct or valid.
– In some systems, there may be scenarios where a correct decision cannot always
be reached, such as in the presence of faulty or malicious processes.
2. Consensus Problem:
– The consensus problem is a more stringent version of the agreement problem. It
requires that all processes agree on a single value, and the value must be valid
and consistent, even in the presence of faulty or crashed processes.
– It ensures that:
• Validity: The value agreed upon is one that was proposed by some
process.
• Uniqueness: All processes agree on the same value.
• Fault Tolerance: The system can handle up to a certain number of faulty
processes while still reaching consensus.

Key Differences:

• Agreement: Just ensures that a decision is made, with no guarantee of validity.


• Consensus: Ensures both agreement and correctness, handling faults in the system and
ensuring a valid outcome.

These answers should provide a thorough understanding of the questions. Let me know if you
need further clarification!
Q.4 (a) What is distributed deadlock?
Distributed deadlock occurs in a distributed system when two or more processes wait
indefinitely for resources that are held by each other, creating a circular wait condition. Since the
system is distributed, detecting and resolving such deadlocks is more complex than in
centralized systems.

• Example Scenario:
Process A holds resource R1 and requests R2, while Process B holds resource R2
and requests R1. This creates a cycle of dependency that leads to deadlock.

• Challenges:
a. No central control to detect the deadlock.

b. Communication overhead in detecting cycles of resource allocation graphs across


the system.

Q.4 (b) Define Atomic Commit Protocols.


Atomic Commit Protocols ensure that in a distributed transaction, either all participating nodes
commit the transaction, or all nodes abort it. The goal is to maintain consistency across
distributed systems.

• Types of Atomic Commit Protocols:


a. Two-Phase Commit (2PC):
• Phase 1 (Prepare): The coordinator asks all participants if they can commit.

• Phase 2 (Commit/Abort): Based on participants' responses, the


coordinator decides to commit or abort.
b. Three-Phase Commit (3PC): Adds an extra phase to avoid blocking, ensuring that
participants can safely decide without waiting indefinitely.
• Example Use Case: Bank transfers involving accounts in different branches.

Q.4 (c) What is a Distributed Transaction?


A distributed transaction spans multiple nodes or systems in a distributed environment and
involves accessing and modifying data on multiple databases or services in a coordinated
manner. The transaction must satisfy the ACID properties (Atomicity, Consistency, Isolation,
Durability) across all involved nodes.

• Characteristics:
a. Executes on multiple systems.

b. Requires synchronization to maintain data integrity.


• Example:
A flight booking system where a single transaction reserves a seat on the flight, books a
hotel room, and arranges car rental, all across different systems.

Q.4 (d) Describe absolute ordering, consistent ordering, and causal


ordering of messages.
1. Absolute Ordering:
Messages are delivered in the exact order they are sent by all processes in the system.
– Example: If Process A sends messages M1, M2, and M3, all processes receive
them in the same order (M1 → M2 → M3).
2. Consistent Ordering:
All processes observe the same order of messages from a single process but may
observe different orders from different processes.
– Example: If Process A sends M1 and M2, and Process B sends M3, all processes
see A's messages in order but may see B's messages interleaved differently.
3. Causal Ordering:
Ensures that causally related messages are delivered in the order of their dependency.
– Example: If Process A sends M1 and later M2 depends on M1, M1 must be
delivered before M2.

Each type of ordering impacts the complexity and performance of message delivery systems in
distributed environments.

OR: How do you ensure the transaction atomicity in distributed


systems?
To ensure transaction atomicity in distributed systems, the following mechanisms are used:

1. Atomic Commit Protocols:


– Two-Phase Commit (2PC) and Three-Phase Commit (3PC) protocols ensure all
participants commit or abort consistently.
2. Logging and Recovery Mechanisms:
– Use of logs to record transaction states ensures recovery in case of failures.
3. Locking Mechanisms:
– Distributed locks prevent conflicts and ensure that all steps of a transaction occur
as a single atomic unit.
4. Timeouts and Fail-Safe Mechanisms:
– Transactions are aborted after a timeout to avoid indefinite blocking.

These mechanisms collectively ensure that distributed transactions maintain their atomicity
despite failures or interruptions.
Q.5 (a) Describe data replication in distributed systems.
Data replication is the process of storing copies of data on multiple nodes in a distributed
system to improve reliability, fault tolerance, and performance.

• Key Benefits:
a. Fault Tolerance: If one node fails, the replicated data on another node ensures
continuity.

b. Improved Read Performance: Multiple replicas allow simultaneous read


operations, reducing latency.

c. Availability: Ensures data is accessible even if some nodes become unavailable.


• Types of Replication:
a. Synchronous Replication: Changes are propagated to all replicas before
confirming the operation to the user. Ensures strong consistency.

b. Asynchronous Replication: Changes are propagated to replicas after confirming


the operation to the user. Improves performance but may cause temporary
inconsistencies.
• Example: Cloud storage services like Google Drive replicate user data across multiple
servers to ensure reliability and availability.

Q.5 (b) Define Group Communication and explain with a suitable


example.
Group communication in distributed systems involves sending messages to a group of
processes (or nodes) rather than individual nodes. It is essential for maintaining coordination,
consistency, and fault tolerance in distributed environments.

• Key Concepts:
a. Multicast Communication: Messages are sent to all members of a group.

b. Atomicity in Group Communication: Ensures that all members receive the


message or none do, maintaining consistency.
• Example:
In a distributed database, a group communication system ensures that all replicas of a
database receive updates simultaneously to maintain consistency. For instance, when a
file update is performed, it must be propagated to all nodes in the system.

Q.5 (c) What is memory coherence?


Memory coherence refers to the consistency of shared data in distributed or parallel systems. It
ensures that any read of a memory location reflects the most recent write.
• Problem: In systems with shared memory, processes may access outdated data due
to caching or network delays, leading to inconsistency.

• Memory Coherence Protocols:


a. Write-Invalidate Protocol: Invalidates other copies when a process writes to a
memory location.

b. Write-Update Protocol: Updates all copies with the new value when a write
occurs.
• Example: In a distributed shared memory system, if Process A updates a variable,
other processes accessing the same variable must see the updated value to maintain
coherence.

Q.5 (d) Explain distributed shared memory system in distributed


environment with a suitable diagram.
A Distributed Shared Memory (DSM) system allows processes on different nodes in a
distributed system to share memory as if they were accessing a single shared address space.
DSM abstracts the complexity of message passing and provides shared memory functionality
over a network.

• Key Features:
a. Transparency: Applications can use shared memory without being aware of the
underlying network communication.

b. Consistency Models: DSM systems must ensure memory coherence through


appropriate consistency models.
• How DSM Works:
a. When a process accesses a memory location, the DSM system retrieves or
updates the value from the remote memory.

b. Memory coherence protocols ensure consistency across all nodes.


• Diagram:
A simple DSM diagram involves several processes (P1, P2, P3) on different nodes
accessing a shared memory pool via a DSM manager.

(A diagram can be drawn showing processes on different nodes connected to a shared memory
space.)
• Example Use Case: Parallel computing applications where processes on multiple nodes
share data, such as scientific simulations.
OR: Explain various memory consistency models. Also give an example
of an application for which causal consistency is the most suitable
consistency model.
Memory consistency models define the rules for the visibility of memory updates in a
distributed system, ensuring correct behavior in concurrent operations.

Types of Memory Consistency Models:


1. Strict Consistency:
– Any read returns the most recent write immediately, ensuring strong consistency.

– Use Case: Critical systems like financial databases.


2. Sequential Consistency:
– Ensures all processes see the same order of operations, but not necessarily in
real-time.

– Use Case: Parallel programming frameworks.


3. Causal Consistency:
– Guarantees that causally related writes are seen in the same order by all
processes, but unrelated writes may appear out of order.

– Use Case: Collaborative applications like Google Docs, where edits by one user
depend on another user's previous changes.
4. Eventual Consistency:
– Ensures that all replicas will eventually converge to the same value if no further
updates are made.

– Use Case: Social media feeds.

Example for Causal Consistency:


In a chat application, causal consistency is ideal because it ensures that a reply to a message is
seen only after the original message, even if different users experience delays in updates.
Diffrent syllabus and pattern

Q.1 (a)
i. Which of the following is NOT a characteristic of a distributed system?
Answer: C) Centralized processing
• Distributed systems do not rely on centralized processing; instead, they are
characterized by decentralization, scalability, and fault tolerance.

ii. Which of the following models describes a Client-Server system?


Answer: C) Client requests services from a central server

• In the client-server model, clients request services, and a central server processes and
provides those services.

Q.1 (b) What is Scalability?


Scalability refers to the ability of a distributed system to handle increasing workloads or
resource demands by adding resources, such as servers, storage, or bandwidth, without
affecting performance significantly.

• Key Types:
a. Horizontal Scalability: Adding more nodes or machines to the system.

b. Vertical Scalability: Increasing the resources (e.g., CPU, RAM) of existing nodes.

Q.1 (c) What are the primary characteristics and goals of a distributed
system?
Characteristics:
1. Transparency: Hides the complexity of the distributed system from users. Types include
access, location, replication, and failure transparency.

2. Scalability: Ability to grow seamlessly to handle more users or processes.

3. Fault Tolerance: Continues functioning despite failures of some components.

4. Resource Sharing: Allows sharing of hardware, software, and data.

Goals:
1. Improved Performance: Using multiple nodes for parallel processing.

2. Reliability: Ensures data and services are always available.

3. Cost Efficiency: Utilizes resources efficiently to reduce operational costs.

OR: What are the main challenges of concurrency in distributed


systems?
Concurrency Challenges:
1. Data Consistency: Ensuring multiple processes do not conflict while accessing shared
resources.

2. Deadlocks: Circular waiting for resources among processes.

3. Race Conditions: Errors due to the order of execution of concurrent operations.

4. Synchronization: Coordinating the processes to ensure correct results, especially with


network delays.

Q.1 (d) Compare architectures like layered, object-based, and service-


oriented architectures.
1. Layered Architecture:
• Definition: Divides the system into layers, where each layer provides services to the one
above it.

• Advantages:
– Simplifies debugging and testing.

– High modularity.

• Example: OSI model in networking.

2. Object-Based Architecture:
• Definition: Based on the concept of objects that encapsulate data and behavior.
Communication occurs via method calls.

• Advantages:
– Encourages reusability and scalability.

– Supports inheritance and polymorphism.

• Example: Distributed object systems like CORBA.

3. Service-Oriented Architecture (SOA):


• Definition: Organizes the system as a set of loosely coupled services that communicate
via standard protocols.

• Advantages:
– High interoperability.

– Encourages reusability of services.

• Example: Web services using SOAP or REST.


OR: How does concurrency impact the design and performance of
distributed applications?
Impact of Concurrency:

1. Design Challenges:
– Requires synchronization mechanisms (e.g., locks, semaphores) to avoid race
conditions and inconsistencies.

– Increased complexity in managing communication and data sharing among


processes.
2. Performance Impacts:
– Positive: Improves throughput and resource utilization by allowing parallel
execution.

– Negative: Can cause bottlenecks due to contention for shared resources, leading
to potential deadlocks or delays.

To handle concurrency effectively, distributed systems must implement mechanisms like thread
management, distributed locking, and fault-tolerant protocols.
Q.2 (a)
i. In distributed systems, a Remote Procedure Call (RPC) enables:
Correct Answer:
B) A program to call a procedure on a remote server

• RPC allows a program to execute a function on another machine in a distributed system


as if it were a local call.

ii. Characteristics of a distributed system are:


1. Scalability: Ability to handle growing workloads by adding more resources.

2. Transparency: Hides complexity and provides seamless access to resources (e.g.,


location and replication transparency).

3. Fault Tolerance: System continues to operate even when components fail.

4. Resource Sharing: Enables multiple nodes to share resources like data, hardware, or
software.
Q.2 (b) Define Synchronization in a Distributed System.
Synchronization in distributed systems refers to the coordination of processes and resources to
maintain consistency and correctness.

• Purpose:
a. Ensures that operations occur in the correct order.

b. Prevents race conditions and conflicts during concurrent access to shared


resources.
• Examples:
a. Clock synchronization to maintain a global time reference.

b. Distributed locks to prevent multiple processes from modifying the same


resource simultaneously.

Q.2 (c) What is the use of a Distributed Hash Table (DHT)?


Distributed Hash Table (DHT) is a decentralized data structure used in distributed systems to
store and retrieve data efficiently.

• Uses:
a. Data Lookup: DHT enables efficient searching and retrieval of data in a peer-to-
peer network.

b. Scalability: Handles large-scale data distribution by spreading it across multiple


nodes.

c. Fault Tolerance: Provides redundancy to ensure data availability even if some


nodes fail.

d. Applications: Used in systems like BitTorrent and blockchain for distributed file
storage and retrieval.

OR: In the context of distributed systems, define 'middleware.'


Middleware refers to software that acts as an intermediary layer between the operating system
and applications in a distributed system.

• Functions:
a. Manages communication between distributed components.

b. Provides services like messaging, authentication, and transaction management.

c. Hides the complexity of underlying hardware and network from application


developers.
• Example: CORBA, Java RMI, and WebLogic.

Q.2 (d) Describe the methods used in distributed systems to handle


failures and achieve fault tolerance.
Methods to Handle Failures:
1. Replication:
– Creates multiple copies of critical data or services across different nodes to
ensure availability in case of failure.
2. Checkpointing:
– Periodically saves the state of the system, allowing it to resume from a known
good state after a failure.
3. Failure Detection:
– Monitors system components to identify and report failures promptly.
4. Redundancy:
– Adds extra hardware or software components to ensure that failure of one does
not impact system operation.
5. Consensus Protocols:
– Ensures agreement among distributed nodes even in the presence of failures
(e.g., Paxos, Raft).

Achieving Fault Tolerance:


• Self-Healing Systems: Detect and recover automatically from faults.

• Load Balancing: Distributes workload to prevent overloading and failure of individual


nodes.

• Rollback Recovery: Reverts to a previous state to recover from errors.

OR: What is Clock Synchronization in Distributed Systems? Explain the difference


between logical and physical clocks and their applications.
Clock Synchronization ensures all nodes in a distributed system maintain a consistent notion of
time, critical for tasks like ordering events or maintaining data consistency.

• Physical Clocks:
– Represents real-world time (e.g., UTC).

– Achieved using protocols like NTP (Network Time Protocol).

– Applications: Timestamping transactions, logging, and event ordering.


• Logical Clocks:
– Abstract time representation, focusing on the order of events rather than real-
world time.

– Examples: Lamport Timestamps, Vector Clocks.

– Applications: Distributed debugging, causal consistency.

Key Difference:

• Physical clocks are synchronized to real-world time, while logical clocks order events
relative to each other.
Q.3 (a)
i. Which architecture relies on every node acting as both a client and a server?
Answer: B) Peer-to-peer (P2P) architecture

• In P2P architecture, every node can act as both a client and a server, enabling direct
sharing of resources without relying on a central server. Examples include BitTorrent and
blockchain networks.
ii. Which of the following is a desirable feature in a Distributed File System?
Answer: B) High availability, fault tolerance, and location transparency

• A desirable distributed file system should ensure:


– High availability: Files are accessible even in case of node failures.

– Fault tolerance: The system can recover from failures.

– Location transparency: Users can access files without knowing their physical
location.

Q.3 (b) What is the purpose of load balancing in distributed systems?


Load Balancing in distributed systems aims to:

1. Distribute workload: Evenly allocate tasks or resources among nodes to prevent


overloading any single node.

2. Improve performance: Ensures efficient utilization of resources and minimizes response


times.

3. Enhance fault tolerance: Balances requests to handle failures or downtime of nodes


seamlessly.

Q.3 (c) The main advantage of caching in distributed systems:


• Reduced Latency: Frequently accessed data is stored closer to the client, reducing the
time taken to retrieve data from the source.

• Improved Performance: Decreases the load on servers and network by serving cached
data.

• Fault Tolerance: Ensures availability of data during network interruptions.

OR: The main disadvantage of caching in distributed systems:


• Data Inconsistency: Cached copies might become outdated if the original data changes.

• Cache Management Overhead: Requires policies (e.g., Least Recently Used, Write-
Through) to manage cache effectively.

• Increased Complexity: Synchronizing cached data across distributed nodes adds


complexity.
Q.3 (d) List and Explain the Desirable Features of a Good Distributed
File System.
A good Distributed File System (DFS) should have the following features:

1. Transparency:
– Access Transparency: Users should not need to know the file's physical location.

– Replication Transparency: Multiple copies of a file should appear as a single file


to users.
2. Fault Tolerance:
– The DFS should continue to function even when nodes or network links fail.
3. Scalability:
– The system should perform efficiently as the number of users, files, or nodes
increases.
4. Concurrency Control:
– Supports multiple users accessing or modifying files simultaneously without
conflicts.
5. High Performance:
– Provides low latency and high throughput for file operations.
6. Security:
– Ensures data integrity and protects against unauthorized access.

OR: Explain Distributed Shared Memory (DSM) and its Benefits in Distributed
Systems.
Distributed Shared Memory (DSM) is an abstraction that provides the illusion of shared
memory to processes across multiple nodes in a distributed system.

• Key Features:
a. Global Address Space: Processes access shared data using a global address
space.

b. Transparency: Abstracts the complexity of message passing.

c. Consistency Models: Defines rules for maintaining data consistency.


• Benefits:
a. Simplified Programming: Developers can write programs as if all processes
share memory.

b. Improved Performance: Reduces message-passing overhead by providing a


unified memory view.

c. Resource Sharing: Efficiently utilizes distributed resources.


• Applications: DSM is used in parallel computing and systems requiring inter-process
communication.

Q.4 (a)
(i) The full names of CORBA and RMI:
1. CORBA: Common Object Request Broker Architecture

2. RMI: Remote Method Invocation

(ii) Which of the following is a popular data replication strategy in distributed


databases?
Answer: C) Primary-backup replication

• Explanation: In the primary-backup replication strategy, one node acts as the primary to
handle all updates, and changes are propagated to backup nodes to maintain
consistency. This is widely used for fault tolerance.

Q.4 (b) Define Mutual Exclusion in Distributed Systems.


Mutual Exclusion ensures that only one process can access a critical section (shared resource) at
a time in a distributed system.

• Purpose:
a. Prevents race conditions and data inconsistency.

b. Ensures correctness when multiple processes try to modify shared data.


• Challenges in Distributed Systems:
a. No shared memory; relies on message passing.

b. Failure of nodes or communication links can complicate mutual exclusion


enforcement.

Q.4 (c) Describe a desirable property of a distributed deadlock


detection algorithm.
A desirable property of a distributed deadlock detection algorithm is:

1. Minimal Communication Overhead: The algorithm should minimize message exchanges


to reduce network congestion.

2. Scalability: It should perform efficiently as the system grows in size.


3. Fault Tolerance: It should handle failures gracefully and not introduce additional
deadlocks.

4. Timeliness: Deadlocks should be detected promptly to ensure smooth operation.

OR: Compare Token-Based and Non-Token-Based Algorithms for Distributed


Mutual Exclusion
Aspect Token-Based Algorithms Non-Token-Based Algorithms
Mechanism Uses a unique token to grant Uses request messages to
access to the critical section. determine access.
Performance Fewer messages (only token Higher message overhead due to
passing). requests and replies.
Fault Tolerance Token loss requires regeneration, Handles failures better without
making recovery complex. reliance on a token.
Example Suzuki-Kasami Algorithm Ricart-Agrawala Algorithm

Q.4 (d) Explain Distributed Deadlock Detection and Differentiate


Between Resource and Communication Deadlocks.
Distributed Deadlock Detection:
• In distributed systems, deadlocks occur when a set of processes waits indefinitely for
resources held by each other. Detection mechanisms include:
a. Wait-for Graphs (WFGs): Constructed from dependency relations among
processes.

b. Edge Chasing: Probes are sent across the system to detect circular wait
conditions.

Differences Between Resource and Communication Deadlocks:


Aspect Resource Deadlocks Communication Deadlocks
Cause Processes wait for unavailable Processes wait for messages that
resources. are never delivered.
Example Two processes holding each Process A sends a message and
other's locks. waits for a reply from Process B,
which also waits for A.

OR: Describe the Ricart-Agrawala Algorithm for Mutual Exclusion in Distributed


Systems in detail.
The Ricart-Agrawala Algorithm is a message-passing-based protocol for achieving mutual
exclusion without a token in distributed systems.

Steps:
1. Request Phase:
– A process sends a "REQUEST" message to all other processes, including its
timestamp.

– Other processes respond based on their critical section state:


• If idle: Send a "REPLY" immediately.

• If busy: Queue the request and send a "REPLY" after exiting the critical
section.
2. Execution Phase:
– A process enters the critical section only after receiving "REPLY" messages from
all other processes.
3. Release Phase:
– After exiting the critical section, the process sends pending "REPLY" messages to
waiting requests.

Features:
• Message Complexity: Requires 2(N - 1) messages per critical section entry (N = number
of processes).

• Logical Clocks: Used to order requests based on timestamps.

• Fault Tolerance: Relatively resilient since no token is needed.

Q.5 (a)
(i) In optimistic concurrency control, a transaction is allowed to:
Answer: C) Execute in isolation and validate before committing

• Explanation: In optimistic concurrency control (OCC), transactions execute without


acquiring locks. Instead, they validate during the commit phase to check for conflicts. If
no conflicts are found, the transaction is committed; otherwise, it is rolled back.

(ii) Define Atomicity.


Atomicity is one of the ACID properties in transaction control.

• It ensures that a transaction is treated as a single indivisible unit.

• All operations in a transaction must either be fully completed or fully rolled back in case
of a failure.

• This prevents partial updates to the database.


Q.5 (b) What is the Two-Phase Commit (2PC) protocol?
The Two-Phase Commit (2PC) protocol is a distributed algorithm used to ensure atomicity in
distributed transactions. It coordinates multiple nodes to ensure that either all commit or all
abort.

Phases:
1. Phase 1: Prepare (Voting Phase)
– The coordinator sends a "PREPARE" message to all participating nodes.

– Each participant responds with "YES" (ready to commit) or "NO" (cannot commit).
2. Phase 2: Commit (or Abort)
– If all participants vote "YES", the coordinator sends a "COMMIT" message, and all
participants commit the transaction.

– If any participant votes "NO", the coordinator sends an "ABORT" message, and all
participants roll back the transaction.

Advantages:
• Ensures atomicity in distributed systems.

Disadvantages:
• Vulnerable to blocking if the coordinator fails.

Q.5 (c) Define locks in transaction control.


Locks are mechanisms used to control concurrent access to shared data by multiple
transactions.

• Purpose:
a. Prevents conflicts by ensuring that only one transaction accesses a resource at a
time.

b. Maintains database consistency.


• Types of Locks:
a. Shared Lock (Read Lock): Allows multiple transactions to read but not modify
data.

b. Exclusive Lock (Write Lock): Allows only one transaction to read and modify
data.

OR: Define deadlock in transaction control.


A deadlock occurs when two or more transactions wait indefinitely for each other to release
locks on resources.

• Example:
a. Transaction A holds Lock 1 and requests Lock 2.

b. Transaction B holds Lock 2 and requests Lock 1.


Both are stuck waiting for each other, resulting in a deadlock.

Q.5 (d) What are nested transactions, and how do they enhance the
management of complex operations in database systems?
Nested Transactions are hierarchical transactions where a parent transaction contains multiple
child transactions.

Features:
1. Isolation: Each child transaction operates independently.

2. Commit Dependency: A child transaction can commit only if its parent transaction
commits.

3. Partial Rollback: If a child transaction fails, only that transaction is rolled back, not the
entire parent transaction.

Benefits:
1. Modularity: Complex tasks can be broken into smaller sub-transactions.

2. Fault Tolerance: Failures in sub-transactions can be handled without affecting others.

3. Concurrent Execution: Allows parallel execution of sub-transactions to improve


performance.

OR: What are the challenges in transaction recovery for distributed systems, and
how do they differ from centralized systems?

Challenges in Transaction Recovery for Distributed Systems:


1. Coordination: Requires synchronizing multiple nodes to ensure consistent recovery.

2. Failure Detection: Identifying which node or link has failed can be difficult.

3. Logging Overhead: Each node maintains its logs, requiring coordination to replay logs.

4. Network Partitioning: Temporary network failures may lead to inconsistent states.

5. Atomicity: Ensuring atomicity across multiple nodes is more complex.


Differences from Centralized Systems:
Aspect Centralized Systems Distributed Systems
Failures Single point of failure. Multiple points of failure.
Coordination No inter-node coordination Requires coordination across
needed. nodes.
Recovery Log Single log for recovery. Distributed logs across nodes.
Communication Not a factor. Network delays can affect
recovery.

Example:
In distributed systems, Two-Phase Commit or Three-Phase Commit protocols are often
required for recovery, whereas centralized systems rely on simpler methods like write-ahead
logging.

You might also like