DC Iat1
DC Iat1
Ans:-
Let me explain the key concepts of distributed systems in terms of software and hardware:
Hardware Concepts:
2. Network Infrastructure: Communication hardware like routers, switches, and network cables
that enable data transmission
3. Storage Systems: Distributed storage devices and memory systems across different locations
4. Resource Sharing: Hardware components shared across the system like printers, storage
devices, etc.
Software Concepts:
1. Middleware: Software layer that sits between the operating system and applications to
manage communication and data exchange
3. Communication Protocols: Software protocols that enable reliable data transfer between
nodes
Key Characteristics:
1. Resource Sharing: Allows sharing of hardware and software resources across the network
Ans:-
1. Client-Server Systems
A centralized server provides services to multiple clients. Clients request services/resources from the
server.
graph LR
S --> C1
S --> C2
S --> C3
All nodes are equal and can act as both client and server. Each peer can request and provide services.
graph LR
P4 --- P1
P2 --- P4
P1 --- P3
Multiple computers work together to solve complex computational problems by dividing tasks.
graph TD
W1 --> M
W2 --> M
W3 --> M
4. Cluster Computing Systems
Multiple computers are connected closely to work as a single system, typically sharing the same
hardware and OS.
graph TD
LB["Load Balancer"]
N2 --- SS
N3 --- SS
Loosely coupled, heterogeneous computers work together across different administrative domains.
graph TD
GC["Grid Controller"]
Each type of distributed system has its own advantages and use cases:
Client-Server: Suitable for centralized services like web applications and databases
Grid Computing: Beneficial for organizations sharing resources across different locations
Core Concepts
2. Message Queuing: Messages are stored in queues until the receiver is ready to process them
Key Components
3. Message Broker: Intermediary system that manages message routing and delivery
Communication Patterns
Advantages
Implementation Examples
graph LR
Microservices communication
Event-driven architectures
Challenges
Performance optimization
**a) RPC**
Ans:-
RPC (Remote Procedure Call) is a protocol that enables a program to execute a procedure
(subroutine) in another address space, typically on a remote computer over a network. Here's a
comprehensive explanation:
Basic Concept
RPC makes remote procedure calls appear as local procedure calls to the programmer, hiding the
complexity of network communication.
1. Client Stub Generation: Creates client-side code that represents remote procedures
4. Server Stub Processing: Unpacks parameters and calls the actual procedure
5. Result Return: Sends results back through the same process in reverse
Components of RPC
graph LR
SS --> S["Server"]
S --> SS
SS --> RT2
RT1 --> CS
CS --> C
Advantages
Challenges
Security concerns
Common Implementations
XML-RPC
Resource Sharing
Transparency
Openness
Scalability
Fault Tolerance
Concurrency
Security
These goals work together to create reliable, efficient, and user-friendly distributed systems that can
handle complex computational tasks across networks.
Ans:-
Transparency is a key design principle in distributed systems that hides the complexity of the
underlying system from users and applications. Here are the different levels of transparency:
Access Transparency
Location Transparency
Migration Transparency
Resources can move between locations without affecting how they are accessed
Replication Transparency
Concurrency Transparency
Failure Transparency
Performance Transparency
Scaling Transparency
These transparency levels work together to create a system that appears as a single, integrated
computing facility to users, despite being distributed across multiple locations and components.
graph TD
T --> MT["Migration"]
T --> RT["Replication"]
T --> CT["Concurrency"]
T --> FT["Failure"]
T --> PT["Performance"]
T --> ST["Scaling"]
Ans:-
Basic Concepts
Types of Groups
Communication Models
graph TD
Reliability Requirements
Applications
Distributed databases
Replicated services
Collaborative applications
Challenges
Scalability issues
Ans:-
Introduction
Berkeley sockets, also known as BSD sockets, are an application programming interface (API) for
Internet sockets and Unix domain sockets. Originally developed for BSD Unix in the early 1980s at the
University of California, Berkeley, they have become the standard API for network programming.
Key Concepts
Protocol Family: Determines the type of communication (TCP/IP, Unix domain sockets)
Socket Types
Stream Sockets (SOCK_STREAM)- Use TCP protocol- Provide reliable, ordered data
transmission- Connection-oriented communication
Client-Server Model
Server:1. Creates socket2. Binds to specific address and port3. Listens for connections4.
Accepts client connections
Advantages
Platform independence
Email servers
FTP applications
Network gaming
Distributed systems
Berkeley sockets remain fundamental to network programming and serve as the foundation for most
modern networking applications and protocols.
Ans:-
Overview of RMI
Remote Method Invocation (RMI) is a fundamental mechanism in distributed computing that allows
objects in one Java Virtual Machine (JVM) to seamlessly invoke methods on objects in another JVM,
even across different physical machines in a distributed system.
1. Client-Side Components
Stub (Client-side Proxy)- Acts as a local representative for remote object- Handles method
invocation packaging- Manages network communication
2. Server-Side Components
Skeleton- Receives remote method calls- Unpacks parameters- Forwards calls to actual
object
1. Server Setup- Creates remote object instance- Registers with RMI registry- Publishes object
reference
2. Client Discovery- Queries RMI registry- Obtains remote object reference- Creates local stub
3. Remote Method Execution- Client invokes method on stub- Parameters are serialized-
Network transmission occurs- Server processes request- Results return to client
// Remote Interface
// Server Implementation
implements DistributedService {
super();
// Server Startup
try {
registry.bind("DistributedService", service);
} catch (Exception e) {
e.printStackTrace();
// Client Usage
public class DistributedClient {
try {
registry.lookup("DistributedService");
} catch (Exception e) {
e.printStackTrace();
RMI serves as a powerful framework for building distributed applications, providing seamless
integration between distributed components while handling the complexities of network
communication and object serialization.
6 Why clock synchronization is required in DS? Explain Physical clock algorithms in detail.
Ans:-
1. Cristian's Algorithm
A centralized approach where clients synchronize with a time server:
Process:- Client requests time from time server- Server responds with its current time- Client
adjusts for network delay- Client sets its time using formula: T = Ts + (RTT/2)
Where:
T = Adjusted time
Ts = Server's timestamp
2. Berkeley Algorithm
A distributed approach where the time server actively synchronizes all machines:
Steps:1. Time daemon polls all machines2. Machines respond with their time3. Daemon
calculates average time4. Daemon sends time adjustments to each machine
Features:- Stratified architecture (Levels 0-15)- Multiple time sources- Complex delay
estimation- Security mechanisms
Clock Drift- Physical clocks tend to drift apart- Different drift rates for different hardware
Implementation Considerations
Accuracy Requirements- Precision needed for application- Trade-off between accuracy and
overhead
7 What is token and non token based algorithm in mutual exclusion? Explain suzuki kasamis
broadcast algorithm for mutual exclusion in detail with example.
Ans:-
Let me explain token and non-token based algorithms for mutual exclusion and the Suzuki-Kasami
algorithm.
Token vs Non-Token Based Algorithms:
1. Token-Based Algorithms:
Only the process holding the token can enter the critical section
This is a token-based algorithm that uses a broadcast mechanism for mutual exclusion. Here's how it
works:
1. Data Structures:
Each process maintains an array LN (Last Request Numbers) tracking the last request number
of every process
1. Algorithm Steps:
o Updates RN array
o Executes CS
Example:
Broadcasts REQUEST
Receives token
Enters CS
P2 broadcasts REQUEST
1. P1 exits CS:
Checks queue
Sends token to P2
Ans:-
Unlike physical clocks that measure real time, logical clocks maintain the ordering of events in a
distributed system without using actual time measurements. They focus on the sequence and
causality of events rather than real-time values.
2. Counter is incremented:
Example:
Event sequence:
This ensures that if event 'a' happens before event 'b', then Clock(a) < Clock(b), maintaining causality
in the distributed system.
Ans:-
Let me explain the key differences between message-oriented and stream-oriented communication:
Message-Oriented Communication:
Stream-Oriented Communication:
Key Differences:
1. Data Structure:
2. Boundaries:
3. Usage:
Ans:-
Let me explain Ricart-Agrawala's algorithm for mutual exclusion in distributed systems:
Ricart-Agrawala's Algorithm:
This is a distributed algorithm for mutual exclusion that uses timestamps and message passing.
Key Components:
Algorithm Steps:
Example:
o P1 requests CS (T=10)
o P2 requests CS (T=15)
Advantages:
Deadlock-free