Distributed System Solved Paper 2023
Distributed System Solved Paper 2023
2023
ER SAHIL KA GYAN
PART A 10 QUESTIONS= 20 MARKS
ER SAHIL KA GYAN
Prob.1: What are the goals of a distributed system?
The main goals of a distributed system are:
1. Transparency
○ Hides complexities from users (location, access, migration, replication, failure).
○ Example: Accessing Google Docs looks the same regardless of where it's stored.
2. Openness
○ Should be built using standardized protocols/interfaces so different systems can interoperate.
3. Scalability
○ Must handle growing workloads or users without performance degradation.
○ Example: E-commerce platforms scale up during festive seasons.
4. Fault Tolerance
○ System should continue operating even if parts fail.
○ Example: If one server fails, another should take over (failover).
5. Resource Sharing
○ Allows shared access to files, printers, databases across the network.
ER SAHIL KA GYAN
Prob.2: State the difference between Distributed Operating System and Network
Operating System.
Example: A Java client calls a getUserData() method hosted on a remote Python server using RPC.
ER SAHIL KA GYAN
Prob.4: How is distributed file system different from centralized file
system?
Location Files stored on a single server Files distributed across multiple nodes
ER SAHIL KA GYAN
Prob.5: Explain concept of logical clocks.
Logical clocks are used to order events in a distributed system where physical clocks may not be synchronized.
● Vector Clocks:
Use Case: Helps in maintaining event order in distributed logging, database transactions, etc.
ER SAHIL KA GYAN
Prob.6: How concurrency is handled in distributed system?
Concurrency ensures that multiple processes or users can safely access shared resources.
● Techniques Used:
○ Timestamp Ordering
○ Distributed Transactions
Example: In distributed banking systems, concurrency control ensures two users don’t overdraw the same account simultaneously.
ER SAHIL KA GYAN
Prob.7: What is Non-Uniform Memory Access (NUMA) model?
NUMA is a memory design where memory access time depends on memory location relative to the processor.
● Characteristics:
● Advantages:
Example: High-performance servers with multiple processors using local RAM per CPU.
ER SAHIL KA GYAN
Prob.8: Explain distributed mutual exclusion.
Distributed mutual exclusion ensures only one process in a distributed system can enter its critical section at a time.
● Techniques:
● Requirements:
○ Mutual Exclusion
Use Case: Ensures consistent updates to shared resources like a file or database record.
ER SAHIL KA GYAN
Prob.9: Explain concept of faults in distributed agreement.
● Types of Faults:
● Handling:
○ Algorithms like Byzantine Fault Tolerance (BFT) or Paxos help in achieving agreement despite faults.
Example: Byzantine generals problem – ensuring all loyal generals agree on the same plan, even with traitors.
ER SAHIL KA GYAN
Prob.10: How data is handled in distributed databases?
Distributed databases manage data across multiple nodes or sites while maintaining consistency and performance.
● Techniques Used:
Example: A shopping app stores inventory data on servers in different regions to reduce latency and handle local demand.
ER SAHIL KA GYAN
PART B 5/7 QUESTIONS= 20 MARKS
ER SAHIL KA GYAN
✅ Prob.11: Explain how microkernels can be used to organize an operating
system in a client-server fashion.
A microkernel is a minimalistic operating system kernel that provides only essential services such as communication between processes, basic
scheduling, and low-level hardware access. All other services like device drivers, file systems, and networking are moved to user space and
implemented as servers, resulting in a client-server architecture.
1. Modularity
● Each module (like file system, device driver) runs as a user-level server.
● Clients (applications or system utilities) interact with these services via IPC (Inter-Process Communication).
ER SAHIL KA GYAN
2. Client-Server Communication
4. Fault Isolation
● Since each component runs in its own address space, a crash in one server doesn’t affect others.
● Faulty components can be restarted without rebooting the entire OS.
5. Enhanced Security
ER SAHIL KA GYAN
✅ Prob.12: Explain transport-level communication services for building
distributed applications.
Transport-level communication is crucial in distributed applications to enable reliable and efficient data exchange across networks. It acts
as a bridge between application-level protocols and lower-level networking.
2. Reliability
ER SAHIL KA GYAN
3. Flow Control
7. Security Features
● Prevents sender from overwhelming receiver.
● TCP uses sliding window mechanism to manage data flow. ● Includes:
○ TLS/SSL for encryption
4. Congestion Control
○ Authentication to verify sender identity
● Detects and reacts to network congestion.
● TCP uses algorithms like: ○ Integrity checks to prevent tampering
○ Slow Start
○ Congestion Avoidance
○ Fast Retransmit
ER SAHIL KA GYAN
✅ Prob.13: What is an Object Adapter?
An Object Adapter is a middleware component in distributed object systems (like CORBA) that helps bridge the gap between the client request
and the actual server object (servant) that processes the request. It handles object life cycle, identity mapping, request dispatching, and other
object management tasks.
● Acts as a translator between the Object Request Broker (ORB) and the servant object.
● Generates unique object references that clients can use to identify server-side objects.
● Parses object references received in client requests.
5. Method Invocation
ER SAHIL KA GYAN
🔶 Example (CORBA System):
● Object adapter interprets object reference → Locates the servant → Calls method → Sends result back.
📝 Conclusion:
The Object Adapter in a distributed object system plays a crucial role in request processing by linking client requests to server objects (servants).
It enhances reusability, flexibility, and modularity, and supports transparent communication in systems like CORBA.
ER SAHIL KA GYAN
Prob.14: Does using time stamping for concurrency control ensure serializability?
Discuss.
Yes, timestamp-based concurrency control ensures conflict serializability by executing transactions in an order consistent with their
timestamps. Every transaction is assigned a unique timestamp when it enters the system, and operations are scheduled based on these
timestamps to avoid conflicts and maintain consistency.
✦ Key Terms:
ER SAHIL KA GYAN
✦ Timestamp Ordering Protocol: ✦ Advantages:
➤ If Ti issues a read(X) operation: 1. ✅ Ensures Serializability: Transactions are executed
in timestamp order ensuring conflict-serializable
● If TS(Ti) < W-timestamp(X) → Reject operation (Ti is too late to read)
schedules.
● Else → Perform the write and update W-timestamp(X) 1. ❌ High Abort Rate: Frequent transaction rollbacks in
high-contention scenarios.
ER SAHIL KA GYAN
Prob.15: Discuss connectionless communication between client and server using
sockets.
Connectionless communication enables client-server data exchange without establishing a persistent connection. It is typically implemented
using the User Datagram Protocol (UDP) and is suitable for scenarios where low overhead, speed, or broadcasting is prioritized over
guaranteed delivery.
🔧 Socket Creation
○ Both client and server create UDP sockets using socket(AF_INET, SOCK_DGRAM, 0)
ER SAHIL KA GYAN
📦 Stateless Communication
● Since UDP is unreliable, some packets may be lost or arrive out of order
● Suitable for apps that can tolerate minor loss (e.g., VoIP, online games)
⚡ Lightweight Protocol
A distributed system consists of processes running on multiple physical machines, communicating via message-passing. Since there's no
shared memory or global clock, determining a global state (i.e., the combined state of all processes and channels) is non-trivial.
● A process can record its local state, but messages in transit (not yet received) may be missed.
● This leads to inconsistent or incorrect global state.
Chandy and Lamport proposed a non-intrusive snapshot algorithm to record a consistent global state.
✅ Algorithm Description
● 🔹 Checkpointing
● 🔹 Deadlock Detection
● 🔹 Garbage Collection
ER SAHIL KA GYAN
● 🔹 Debugging and Recovery
✅ Definition of Consistent Global State
A global state is consistent if: Every message recorded as received is also recorded as sent.
📌 Formal Condition:
For any message mᵢⱼ:
Timeline →
GS₁ = {LS¹₁, LS²₂, LS³₃} → ❌ Inconsistent: m₁₂ received by P₂, but not sent by P₁.
GS₂ = {LS²₁, LS³₂, LS⁴₃} → ✅ Consistent: All channels either empty or have pending (not-yet-received) messages.
✅ Conclusion
Chandy-Lamport snapshot algorithm captures consistent global state without halting or disrupting the system. It's a foundational technique in distributed computing for
reliable system monitoring and recovery.
ER SAHIL KA GYAN
Prob. 17: Explain distributed shared memory (DSM) with the help of a diagram.
DSM provides the abstraction of shared memory across multiple machines without physically sharing memory.
✔ Applications behave as if they are accessing a single shared memory, even though data is distributed across nodes.
1.
ER SAHIL KA GYAN
✅ Types of DSM
1. On-Chip Memory
○ Data on CPU chip.
○ Fast access, expensive, and complex.
2. Bus-based Multiprocessors
○ Shared bus connects memory and CPUs.
○ Cache memory used to minimize traffic.
3. Ring-based Multiprocessors
○ Token ring topology.
○ Shared memory emulated through token-passing.
✅ Advantages of DSM
1. Simplified Abstraction
○ Programmers write as if using shared memory.
2. Easier Portability
○ Natural migration from sequential to distributed systems.
3. Locality of Data
○ Nearby data fetched together for efficiency.
4. On-demand Data Movement
○ Reduces unnecessary communication overhead.
5. Larger Virtual Memory Space
○ Combined memory of all nodes acts as a single space.
ER SAHIL KA GYAN
PART C 3/5 QUESTIONS= 30 MARKS
ER SAHIL KA GYAN
Prob. 18: Integration of Two CORBA Systems with Independent Naming
Services
CORBA Systems
(Common Object Request Broker Architecture) is a standard defined by the OMG that enables objects to communicate across networks
regardless of the programming languages, platforms, or operating systems.
Integration Strategy:
To integrate two CORBA systems, each with its own Naming Service, follow the steps below:
2. ORB Configuration
Configure each system’s ORB (Object Request Broker) to recognize and reference both local and remote naming services.
○ Include necessary details like hostnames, ports, and protocols.
3. Object Registration
Register critical objects in each system's naming service using unique name bindings
ER SAHIL KA GYAN
4.Cross-System Object Discovery
Enable each system to query and resolve names from the remote naming context.
○ Communication failures
○ Inconsistent references
○ Object discovery
○ Remote method invocation
○ Error resilience
✅ Result: Objects in one CORBA system can be discovered and used by clients in another system.
ER SAHIL KA GYAN
Prob. 19
The RPC2 system in the Coda Distributed File System supports remote procedure calls with potential side effects due to the distributed
nature of execution.
ER SAHIL KA GYAN
🎯 Goal: Implement timeout, rollback, retry mechanisms, and strong concurrency control to manage these side effects.
(b) Implementation and Resolution of a Coda File Identifier (FID) Component Description
ER SAHIL KA GYAN
Prob.20: Explain the following strategies used for deadlock handling in distributed
systems: (a) Deadlock Prevention (b) Deadlock Avoidance (c) Deadlock Detection and Recovery
Deadlock prevention ensures that at least one of the four necessary conditions for deadlock does not hold. In distributed systems, two
popular techniques are used:
Case A:
Case B:
● Involves preemptive decision making: The system only grants resource requests if they do not lead to a
deadlock.
ER SAHIL KA GYAN
🔁 Banker's Algorithm:
A resource allocation algorithm used to check if a safe sequence of process execution exists.
Step-by-step Summary:
1. Input Matrices:
○ Allocation: Currently allocated resources. Available: A=1, B=5, C=2, D=0
○ Max: Maximum resources a process may need.
○ Available: Free resources in the system. Process Allocation Max Need (Max - Allocation)
○ Need = Max - Allocation AA
2. Safe State Conditions:
○ Start with Available = Work P0 0012 0012 0000
○ Find a process Pi such that:
Finish[i] = false and Need[i] <= Work P1 1000 1750 0750
○ If found:
Work = Work + Allocation[i] P2 1354 2356 1002
Finish[i] = true
Add Pi to the Safe Sequence. P3 0632 0652 0020
3. Repeat until all processes finish or no suitable Pi is found.
P4 0014 0656 0642
ER SAHIL KA GYAN
○ ✅ Safe Sequence (as per algorithm):
○ Step-by-step Execution:
○
○ → P0 satisfies conditions → Work = Work + Allocation of P0
○ → P2 satisfies → Work updated
○ → P3 satisfies → Work updated
○ → P4 satisfies → Work updated
○ → P1 satisfies → Work updated
○
○ ✅ Final Safe Sequence: <P0, P2, P3, P4, P1>
○ → All Finish[i] = true ⇒ System is in a **Safe State**
○
ER SAHIL KA GYAN
✅ (c) Deadlock Detection and Recovery
Deadlock Detection allows the system to detect deadlocks after they occur and then recover from them.
🔍 Detection:
● Similar to the Banker's Algorithm, but allows allocations without checking for a safe state.
● Uses Wait-For Graph (WFG):
A cycle in the graph → Deadlock detected
🔁 Recovery Techniques:
1. Process Termination:
2. Resource Preemption:
Prevention Design system to avoid conditions Simple to implement May lead to low resource utilization
for deadlock policies
Avoidance Check before allocation, use safe states Deadlock is avoided Requires advance knowledge of
dynamically resource needs
Detection & Allow deadlocks and then handle them Resources utilized efficiently Overhead in detection & recovery
Recovery
ER SAHIL KA GYAN
Prob.21: Explain Lamport's Clock and Vector Clock with the help of suitable example.
Lamport's logical clock is a mechanism to order events in a distributed system where no global clock exists.
1. LC1 (Increment Rule): Each process increments its clock before executing an event.
2. LC2 (Send Rule): When a process sends a message, it sends its timestamp (logical clock value) along with the message.
3. LC3 (Receive Rule): When a process receives a message, it sets its clock to max(local clock, timestamp in message) + 1.
Let’s say we have 3 processes: P1, P2, and P3, and a sequence of events:
P1: a → m1 b → m2 c
(to P2) (to P3)
P2: d ← m1 e
P1 a 1
P1 Send m1 2
P2 e 4
P1 b 3
P1 Send m2 4
P3 Receive m2 (timestamp=4), so f = 5
P3 g 6
ER SAHIL KA GYAN
Vector Clock:
Vector clocks solve a limitation in Lamport’s clocks by allowing causal ordering of events (not just "happens-before").
1. VC1 (Increment): Before executing an event, a process increments its own clock.
2. VC2 (Send Rule): On sending a message, a process includes its vector clock.
3. VC3 (Receive Rule): On receiving a message, it takes element-wise max(received clock, local clock) and increments its own clock.
P1: a [1, 0, 0]
P2: e [2,2,0]
ER SAHIL KA GYAN
Prob.22: Explain sender-initiated and receiver-initiated algorithms for dynamic load sharing
and balancing in distributed systems.
Dynamic load sharing in distributed systems aims to redistribute processes from overloaded nodes to underloaded nodes to ensure
optimal system performance.
Steps:
Disadvantages:
Steps:
Disadvantages:
Example Use Case Job migration, thread offloading Task fetching by idle server
ER SAHIL KA GYAN
THANK YOU
SUBSCRIBE AND SHARE - ER SAHIK KA GYAN
ER SAHIL KA GYAN