0% found this document useful (0 votes)
4 views122 pages

Distributed System

The document discusses Interprocess Communication (IPC), its characteristics, types of communication (synchronous and asynchronous), and the concept of blocking receive in Java. It also explains the 'happened-before' relationship in Lamport's logical clock algorithm, the need for External Data Representation (XDR), and the Berkeley clock synchronization algorithm. Additionally, it covers the Network Time Protocol (NTP) and its architecture, highlighting the importance of clock synchronization in distributed systems.

Uploaded by

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

Distributed System

The document discusses Interprocess Communication (IPC), its characteristics, types of communication (synchronous and asynchronous), and the concept of blocking receive in Java. It also explains the 'happened-before' relationship in Lamport's logical clock algorithm, the need for External Data Representation (XDR), and the Berkeley clock synchronization algorithm. Additionally, it covers the Network Time Protocol (NTP) and its architecture, highlighting the importance of clock synchronization in distributed systems.

Uploaded by

07tanishkap
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Unit 1

Q1 What are the general characteristics of inter-process communication? What are various types
of synchronous and asynchronous communication in IPC? Why does blocking receive have no
disadvantages in Java?

1. Interprocess Communication (IPC)

Interprocess Communication (IPC) is a mechanism that allows different processes to exchange data
and coordinate their actions in a distributed system.

IPC is important because processes in a distributed system run separately but need to communicate
to perform tasks together.

2. General Characteristics of IPC

(i) Message Exchange

 Processes communicate by sending and receiving messages.

 Data is transferred from one process to another.

Example: Client sends request to server.

(ii) Process Synchronization

 IPC helps processes coordinate their operations.

 One process may wait for another before continuing.

(iii) Independent Processes

 Processes have their own memory and execution.

 IPC provides a way to communicate without sharing program code.

(iv) Reliability

 Messages should reach the destination correctly.

 IPC handles message delivery and error detection.

(v) Ordering

 Messages may need to be received in the same order they were sent.

(vi) Security

 IPC should prevent unauthorized access to messages.

(vii) Scalability

 IPC should work efficiently even when many processes communicate.

(viii) Transparency

 A process should communicate without worrying about where the other process is located.

3. Types of Communication in IPC


IPC communication can be of two types:

1. Synchronous Communication

2. Asynchronous Communication

A) Synchronous Communication

In synchronous communication, the sender and receiver must coordinate in time.

The sending process may wait until the receiver gets the message.

Types of synchronous communication:

(i) Blocking Send

 Sender sends message and waits until message is received or copied safely.

Example: Sender cannot continue immediately.

(ii) Blocking Receive

 Receiver waits until a message arrives.

Example: Process stops and waits for input.

Features:

 Sender and receiver work together at the same time.

 Easy to control communication.

 Slower because waiting occurs.

B) Asynchronous Communication

In asynchronous communication, sender and receiver do not need to wait for each other.

Communication happens independently.

Types of asynchronous communication:

(i) Non-blocking Send

 Sender sends message and continues execution immediately.

(ii) Non-blocking Receive

 Receiver checks for message.

 If no message is available, it continues instead of waiting.

Features:

 Faster communication.

 Better system performance.

 More complex to manage.

4. Difference between Synchronous and Asynchronous IPC


Synchronous IPC Asynchronous IPC

Sender/receiver may wait No waiting required

Blocking operations used Non-blocking operations used

Easier to manage More complex

Slower Faster

5. Why is Blocking Receive not a Disadvantage in Java?

Blocking receive means a process waits until a message arrives.

Normally, waiting may seem like a disadvantage, but in Java it is not a disadvantage because:

(i) Multi-threading Support

 Java supports multiple threads.

 If one thread waits, other threads continue working.

(ii) Efficient CPU Usage

 Waiting thread does not waste CPU time.

 CPU can be used by other threads.

(iii) Simplifies Programming

 No need to repeatedly check for messages.

 Code becomes simpler and easier.

(iv) Java Networking APIs Support Blocking Operations

 Java sockets and streams are designed to work efficiently with blocking receive.

(v) Better Resource Management

 Blocking avoids unnecessary polling and reduces system load.

Q2 Explain the concept of “happened-before” relationship in the context of Lamport’s


logical clock algorithm. How does an algorithm assign timestamps to events in a
distributed system?
1. Happened-Before Relationship
In a distributed system, many processes run on different machines. Since there is no
common global clock, it is difficult to know which event happened first.
To solve this problem, Leslie Lamport introduced the happened-before relationship (→).
Definition:
If event A happens before B, then it is written as:
A→B
This means event A causally affects event B.
It helps to determine the logical order of events in a distributed system.
2. Rules of Happened-Before Relationship
There are three main rules:
(i) Same Process Rule
If two events occur in the same process, the event that occurs first happened before the
next event.
Example:
If process P has events:
e1, e2, e3
Then:
e1 → e2 → e3
(ii) Message Passing Rule
If one event sends a message and another event receives that message, then:
Send → Receive
Example:
If process P1 sends a message at event A and process P2 receives it at event B:
A→B
This is because receive cannot happen before send.
(iii) Transitive Rule
If:
A → B and B → C
Then:
A→C
This helps establish indirect ordering.
3. Why Happened-Before is Important
It helps in:
 Finding correct order of events
 Maintaining causal relationships
 Synchronizing distributed systems
 Detecting event dependencies
4. Lamport’s Logical Clock Algorithm
Lamport introduced logical clocks to assign timestamps to events based on happened-
before relation.
Each process maintains its own logical clock (C).
5. Rules for Assigning Timestamps
Rule 1: Increment Clock for Every Event
Before every event in a process:
Clock = Clock + 1
Assign this value as timestamp.
Rule 2: Sending a Message
When a process sends a message:
 Increment clock
 Attach timestamp to the message
Example:
If clock becomes 5, message carries timestamp 5
Rule 3: Receiving a Message
When a process receives a message with timestamp Tm:
Receiver updates its clock as:
C = max(C, Tm) + 1
Then assign this value to the receive event.
This ensures event ordering is preserved.
6. Example of Ordering Events
Suppose there are two processes P1 and P2
Process P1
Event A occurs
Clock:
C=1
Then P1 sends a message to P2
Send event timestamp = 2
(Message carries timestamp 2)
Process P2
Current clock = 1
Receives message with timestamp = 2
Using Lamport rule:
max(1,2)+1 = 3
So receive event gets timestamp 3
Final Order

Event Timestamp

A 1

Send Message 2

Receive Message 3

Thus:
A → Send → Receive
This shows correct ordering of events.
7. Limitations of Lamport Clock
Although useful, Lamport clock has some limitations:
(i) Cannot Detect Concurrent Events
If two events happen independently at the same time, Lamport clock cannot tell that they
are concurrent.
It only gives timestamps.
(ii) Timestamp Order Does Not Always Mean Causality
If:
Timestamp(A) < Timestamp(B)
It does not always mean A caused B.
Only logical order is shown.
(iii) Different Events Can Have Same Relation Ambiguity
Extra process ID may be needed to break ties.
(iv) No Real Physical Time
Lamport clock gives logical time, not actual clock time.
Q3 Explain external data representation (XDR), marshalling and unmarshalling. Why is XDR
required? Discuss in brief the three alternative approaches.
1. External Data Representation (XDR)
XDR (External Data Representation) is a standard format used to represent data in a
machine-independent way in distributed systems.
Different computers may have:
 Different operating systems
 Different data formats
 Different byte ordering
So, data sent from one machine may not be understood correctly by another machine.
XDR solves this problem by converting data into a common standard format before
transmission.
Simple Definition:
XDR = Common language for data exchange between different computers
2. Need for XDR (Why is XDR required?)
In distributed systems, different machines may represent data differently.
Example:
One machine may store integer as:
Big-endian
Another machine may store integer as:
Little-endian
If data is sent directly, the receiver may interpret it incorrectly.
XDR is required because:
(i) Machine Independence
 Allows communication between different machines.
(ii) Standard Data Format
 Converts data into a common format.
(iii) Data Portability
 Data can move between systems safely.
(iv) Correct Interpretation
 Receiver correctly understands data.
(v) Supports Heterogeneous Systems
 Useful when systems use different architectures.
3. Marshalling
Marshalling is the process of collecting data and converting it into a standard format (such
as XDR) before sending it over a network.
It prepares data for transmission.
Definition:
Marshalling = Convert internal data → transferable format
Example:
Suppose data:
 Integer = 10
 String = "Hello"
Before sending:
These are converted into standard byte format.
Steps in Marshalling:
1. Collect data
2. Convert to standard format
3. Pack into message
4. Send over network
4. Unmarshalling
Unmarshalling is the reverse process.
It converts received data from standard format back into machine’s local format.
Definition:
Unmarshalling = Convert received format → local machine format
Steps:
1. Receive message
2. Extract data
3. Convert to local format
4. Use the data
5. Example of Marshalling and Unmarshalling
Suppose:
Client sends:
 Number = 25
At sender:
25 → converted into XDR format → sent
(Marshalling)
At receiver:
XDR format → converted back into 25
(Unmarshalling)
6. Three Alternative Approaches to Data Representation
There are three alternatives for handling data representation in distributed systems.
Approach 1: Receiver Makes No Conversion
 Sender sends data in its own format.
 Receiver tries to interpret directly.
Problem:
 Works only if both machines are same.
 Fails in heterogeneous systems.
Disadvantage:
Not practical.
Approach 2: Receiver Converts Data
 Sender sends data in its own format.
 Receiver knows sender’s format and converts it.
Advantage:
 Some flexibility
Disadvantage:
 Receiver must understand many machine formats
 Complex
Approach 3: Use Standard External Representation (XDR)
 Sender converts data to a common format
 Receiver converts from common format to local format
Process:
Sender → XDR → Network → Receiver
Advantage:
 Machine independent
 Easy communication
 Most widely used
Disadvantage:
 Extra conversion overhead
Q4 Discuss the problem of clock synchronization in distributed operating systems.
Illustrate the Berkeley’s clock synchronization algorithm with neat diagram and the
drawback of Network Time Protocol (NTP).
1. Introduction
In a distributed system, multiple computers work together but each computer has its own
local clock.
These clocks are based on hardware oscillators and may run at slightly different speeds.
As a result, clocks on different machines may show different times.
This creates the clock synchronization problem.
2. Why is Global Time Impossible in Distributed Systems?
A global clock means all machines have exactly the same time.
In distributed systems, this is impossible because:
(i) No Shared Physical Clock
 Each computer has its own hardware clock.
 There is no single clock shared by all systems.
(ii) Clock Drift
 Hardware clocks do not run at exactly the same speed.
 One clock may run fast, another slow.
This causes clock drift.
(iii) Message Transmission Delay
 Synchronization messages take time to travel over the network.
 Delay is not constant.
So exact time cannot be known.
(iv) Unpredictable Network Delay
 Network traffic changes.
 Message delay may vary.
Thus perfect synchronization is impossible.
Conclusion:
Because of clock drift + network delay + separate clocks, exact global time cannot be
achieved.
Only approximate synchronization is possible.
3. Why is Clock Synchronization Necessary?
Clock synchronization is important because distributed systems need correct event timing.
Uses of synchronization:
(i) Event Ordering
To know:
 Which event happened first
 Correct sequence of actions
(ii) File Updates
Used in:
 File systems
 Database transactions
To avoid conflicts.
(iii) Logging and Monitoring
System logs need synchronized timestamps.
(iv) Security
Authentication systems use time-based verification.
(v) Distributed Applications
Banking, airline reservation, cloud systems need synchronized clocks.
4. Design Requirements for Clock Synchronization System
A synchronization system should satisfy:
(i) Accuracy
Clocks should be as close as possible.
(ii) Reliability
Should work even if some machine fails.
(iii) Scalability
Should work for small and large networks.
(iv) Fault Tolerance
Failure of one node should not crash synchronization.
(v) Low Communication Cost
Should not send too many synchronization messages.
(vi) Security
Synchronization messages should be protected.
(vii) Fast Convergence
System should quickly synchronize clocks.
5. Active Time Server Based Centralized Clock Synchronization Algorithm
This is a centralized method.
A special machine called Time Server keeps the correct time.
All other machines synchronize with it.
Working:
Step 1: Client sends request to Time Server.
Step 2: Server replies with current time.
Step 3: Client estimates network delay.
Step 4: Client updates its clock.
Diagram:
Client 1 ----\
Client 2 ----- > Time Server
Client 3 ----/
Formula:
Client sets:
New Time = Server Time + Estimated Delay
Advantages
 Simple
 Easy to implement
 Accurate in small systems
Disadvantages
 Single point of failure
 Server overload possible
6. Problem of Clock Synchronization in Distributed Operating Systems
Main problems:
 No global clock
 Clock drift
 Variable network delay
 Machine failures
 Inconsistent event ordering
Hence synchronization algorithms are needed.
Q5 What is NTP? With the help of a diagram, describe how NTP works.
NTP (Network Time Protocol) is a protocol used to synchronize the clocks of computers
over a network or the Internet.
It helps all computers maintain approximately the same correct time.
NTP uses UTC (Universal Coordinated Time) as the standard reference time.
2. Need for NTP
In distributed systems:
 Each computer has its own clock
 Clocks may run fast or slow
 Network applications need same time
Without synchronization:
 Event ordering becomes wrong
 Logs become inconsistent
 Transactions may fail
So NTP is used.

3. NTP Architecture (Using Given Diagram)


The given figure shows NTP working in a hierarchical structure.
There are different levels called Strata.
Explanation of Diagram
 Top clocks → Highly accurate reference clocks (UTC, GPS, atomic clocks)
 Level 1 (Stratum 1) → Primary time servers connected to reference clocks
 Level 2 (Stratum 2) → Servers synchronized with Stratum 1
 Level 3 (Stratum 3) → Lower-level clients/servers synchronized with Stratum 2
Red arrows show time synchronization messages exchanged between servers.
4. Stratum Levels in NTP
Stratum 0
These are highly accurate devices:
 Atomic clocks
 GPS clocks
 Radio clocks
They do not connect directly to users
Stratum 1
Primary servers connected directly to Stratum 0.
They provide accurate time to lower servers.
Stratum 2
Receive time from Stratum 1.
Can also exchange time among themselves.
Stratum 3 and Lower
Receive time from upper servers and provide time to local systems.
5. How NTP Works
NTP synchronizes clocks in the following steps:
Step 1: Client sends request
A client sends a request to an NTP server asking for current time.
Step 2: Server records timestamps
NTP uses 4 timestamps:

Symbol Meaning

T1 Time request leaves client

T2 Time request reaches server

T3 Time reply leaves server

T4 Time reply reaches client

Step 3: Calculate Delay and Offset


NTP calculates:

Step 4: Adjust Clock


Client adjusts its local clock using calculated offset.
6. Peer-to-Peer Synchronization
As shown in the diagram:
Servers at same level also communicate with each other.
This helps:
 Improve accuracy
 Detect faulty servers
 Increase reliability
(Shown by horizontal red arrows in figure)
Q6 Illustrate the Berkeley’s clock synchronization algorithm with neat diagram and the
drawback of NTP.
In a distributed system, every computer has its own local clock.
Since clocks run at slightly different speeds, they may show different times.
To make all clocks nearly equal, clock synchronization algorithms are used.
One such algorithm is the Berkeley Clock Synchronization Algorithm.
2. What is Berkeley Clock Synchronization Algorithm?
The Berkeley algorithm is a clock synchronization method used in distributed systems where
there is no external UTC (real-world) time source.
In this algorithm:
 One machine acts as Master
 Other machines act as Slaves
The master collects time from all machines, calculates an average time, and tells each
machine how much to adjust its clock.
Simple Definition:
Berkeley Algorithm = Average clock synchronization method using a master machine
3. Neat Diagram of Berkeley Algorithm
Slave 1
|
|
Slave 2 --- Master --- Slave 3
|
|
Slave 4
Explanation:
 Master communicates with all slaves
 Slaves send their current time
 Master calculates average time
 Master sends adjustment values back
4. Working of Berkeley Algorithm
Berkeley algorithm works in the following steps:
Step 1: Master polls all machines
Master asks all slave machines:
“What is your current time?”
Step 2: Slaves reply with their time
Each slave sends its local clock value.
Example:

Machine Clock Time

Master 10:00

Slave 1 10:02

Slave 2 09:58

Slave 3 10:01

Step 3: Master calculates average time


Average:
(10:00 + 10:02 + 09:58 + 10:01) ≈ 10:00
Faulty clocks may be ignored.
Step 4: Master sends adjustment
Master tells each machine:
 Increase clock
 Decrease clock
Example:

Machine Adjustment

Slave 1 -2 min

Slave 2 +2 min

Slave 3 -1 min

Step 5: All clocks become synchronized


All machines adjust their clocks and show nearly same time.
7. Drawbacks of NTP (Network Time Protocol)
NTP is another synchronization protocol used on the Internet, but it has some drawbacks.
(i) Network Delay Affects Accuracy
NTP assumes network delay can be estimated.
If network traffic is heavy, delay becomes unpredictable and time may become inaccurate.
(ii) Complex Algorithm
NTP is more complex than Berkeley algorithm.
Requires multiple timestamp calculations.
(iii) Security Problems
Fake or malicious NTP servers can provide wrong time.
This can affect distributed applications.
(iv) Depends on External Time Servers
NTP needs access to Internet time servers.
If servers fail or network disconnects, synchronization is affected.
(v) Less Accurate in Congested Networks
Heavy traffic can increase delay and reduce synchronization accuracy.
Difference Between Berkeley and NTP

Berkeley Algorithm NTP

Uses master machine Uses UTC time servers

Average time method Internet-based synchronization

No external clock needed External reference needed

Good for LAN Good for Internet

Master failure possible Network delay issues

Q7 What is the purpose of Message Passing Interface? Illustrate the architectural model
for MPI using send and receive primitives. (appears multiple times)
MPI (Message Passing Interface) is a standard communication library used in parallel and
distributed computing.
It allows different processes running on different processors or computers to communicate
with each other by sending and receiving messages.
Simple Definition:
MPI = A standard for communication between processes using message passing
2. Purpose of MPI
In distributed systems, each process runs independently and has its own memory.
One process cannot directly access another process’s memory.
Therefore, MPI is used to exchange data through messages.
Main Purposes of MPI
(i) Process Communication
MPI allows one process to send data to another process.
(ii) Parallel Processing
Multiple processors can work on parts of a task simultaneously.
(iii) Synchronization
Processes coordinate and exchange results.
(iv) High Performance Computing
MPI is used in supercomputers and clusters.
(v) Portability
MPI programs work on many hardware systems.
3. Architectural Model of MPI (Using Given Diagram)
The given figure shows the basic MPI architecture.
Explanation of Diagram:
 CPU Core 1 runs Process 0
 CPU Core 2 runs Process 1
 Each process has:
o Its own Memory
o Its own Data
A message is sent from Process 0 to Process 1
This communication happens through MPI.
Diagram Representation
What the Diagram Shows
 Process 0 contains data in its local memory
 Process 0 uses MPI_Send()
 Message travels through communication channel
 Process 1 receives data using MPI_Recv()
 Received data is stored in Process 1 memory
This is the message-passing model of MPI
4. Send and Receive Primitives in MPI
MPI communication is mainly based on two primitives:
(i) MPI_Send()
Used to send data from one process to another.
Syntax:
MPI_Send(data, count, datatype, destination, tag, communicator)
Parameters:
 data → message to send
 count → number of items
 datatype → type of data
 destination → receiver process
 tag → message identifier
 communicator → communication group
(ii) MPI_Recv()
Used to receive data.
Syntax:
MPI_Recv(data, count, datatype, source, tag, communicator, status)
Parameters:
 data → received message
 source → sender process
 Other parameters same as send
5. Working of MPI Communication
Step 1
Process 0 prepares data in memory.
Step 2
Process 0 calls MPI_Send()
Step 3
Data is sent as a message.
Step 4
Process 1 calls MPI_Recv()
Step 5
Data is stored in Process 1 memory.
6. Point-to-Point Communication in MPI
The communication shown in the diagram is called point-to-point communication.
Meaning:
One sender → One receiver
Diagram:
Process 0 ---- MPI_Send() ----> Process 1
Process 1 <--- MPI_Recv() ---- Process 0
Features:
 Direct communication
 One sender
 One receiver
 Uses send and receive primitives
1. MPI_Ssend (Synchronous Send)
MPI_Ssend is a synchronous send operation.
 The sender sends a message and waits until the receiver starts receiving it.
 Communication completes only when receiver is ready.
Advantage:
 Safe and reliable communication
Disadvantage:
 Slower because sender waits
Memory Tip:
Ssend = Synchronous = Sender Waits
2. MPI_Bsend (Buffered Send)
MPI_Bsend is a buffered send operation.
 The message is first copied into a buffer memory
 Sender continues immediately without waiting for receiver
Advantage:
 Faster communication
Disadvantage:
 Requires extra buffer memory
Memory Tip:
Bsend = Buffer = Store first, send later
3. MPI_Rsend (Ready Send)
MPI_Rsend is a ready send operation.
 Sender sends message only if receiver is already ready
 If receiver is not ready, an error may occur
Advantage:
 Faster than normal send
Disadvantage:
 Unsafe if receiver is not prepared
Memory Tip:
Rsend = Receiver Ready
4. MPI_Isend (Non-blocking / Immediate Send)
MPI_Isend is a non-blocking send operation.
 Sender starts sending message
 Sender continues execution immediately
 Does not wait for completion
Advantage:
 Better performance
 Supports parallel work
Disadvantage:
 More complex to manage
Memory Tip:
Isend = Immediate = No Waiting
Q8 Discuss the purpose of overlay network. Describe in brief, any three types of Overlay.
An Overlay Network is a virtual network built on top of an existing physical network.
In an overlay network:
 Nodes are connected through logical links
 These logical links use the underlying Internet or physical network to communicate
So, the overlay creates a network over another network.
Simple Definition:
Overlay Network = Virtual network built on top of physical network
2. Purpose of Overlay Network
Overlay networks are used to improve communication and provide extra network services.
Main Purposes:
(i) Easy Communication
Provides direct logical communication between nodes.
(ii) Resource Sharing
Helps share files, services, and applications between users.
(iii) Improved Routing
Can choose better paths than physical network routing.
(iv) Scalability
Supports large distributed systems.
(v) Fault Tolerance
If one path fails, another path can be used.
(vi) Supports Special Applications
Used in:
 Peer-to-peer systems
 VPN
 Content Delivery Networks
 Distributed systems
3. Types of Overlay Networks
There are many types of overlay networks.
Any three are:
A) Peer-to-Peer (P2P) Overlay Network
In this type:
 Each node acts as both client and server
 Nodes directly communicate and share resources
Example:
 BitTorrent
 Skype (older architecture)
Features:
 No central server
 Resource sharing
 Scalable
Diagram:
Node A ↔ Node B ↔ Node C
↕ ↕ ↕
Node D ↔ Node E ↔ Node F
Advantage:
 Distributed and scalable
B) Structured Overlay Network
In this type:
 Nodes are organized in a structured manner
 Uses special algorithms for searching data
Examples:
 Distributed Hash Table (DHT)
 Chord
Features:
 Organized node structure
 Fast searching
 Efficient routing
Example:
Each node stores data using a key.
Advantage:
 Quick data lookup
C) Unstructured Overlay Network
In this type:
 Nodes connect randomly
 No fixed structure
Examples:
 Early P2P systems like Gnutella
Features:
 Easy to join/leave
 Search by broadcasting queries
Advantage:
 Simple to build
Disadvantage:
 Search can be slow
D) Hybrid Overlay Network (Extra)
In this type:
 Combines central server and peer-to-peer model
Example:
 Modern Skype architecture
Advantage:
 Better performance
Components in the Skype Diagram
1. Skype Login Server (Top)
 The Skype server at the top is the central login server.
 It performs authentication (checks username and password).
 Once authentication is complete, it does not handle the actual call.
Function: User authentication only.
2. Skype Clients (Blue small S nodes)
 The small blue S symbols represent ordinary Skype clients/users.
 These are normal devices used for:
o Voice calls
o Video calls
o Chat
Function: End users in the Skype network.
3. Super Nodes (Yellow large S nodes)
 The yellow large S symbols represent Skype Super Nodes.
 These are powerful systems with:
o Public IP address
o High bandwidth
o Better processing capability
Functions:
 Maintain user information
 Route traffic between clients
 Help establish communication
Working of Skype Overlay Architecture
Step 1: Authentication
 A Skype client first contacts the Login Server.
 The login server verifies the username and password.
Shown in diagram: Authentication arrow toward Skype server.
Step 2: Client Connects to Super Node
 After login, the client connects to a nearby Super Node.
 Super nodes keep track of online users.
Step 3: Communication Between Users
Case 1: Direct Connection
 If two Skype clients can connect directly:
Client A ↔ Client B
 Communication happens directly in peer-to-peer mode.
Case 2: Through Super Nodes
 If direct communication is not possible (NAT/firewall):
Client A → Super Node → Super Node → Client B
 Super nodes route the call/data.
Benefits (Advantages) of Overlay Network
1. Scalability – Easy to add new nodes/users without changing the physical network.
2. Efficient Routing – Data can be routed through alternate paths.
3. Fault Tolerance – If one node fails, communication can continue through another
node.
4. Flexibility – Works on top of existing Internet infrastructure.
5. Cost Effective – No need to build a separate physical network.
6. Supports P2P Communication – Enables direct communication between users.
7. Load Sharing – Traffic can be distributed among multiple nodes.
Q9 What are the two important properties of token-based approach? Explain token-ring
algorithm to achieve mutual exclusion in a distributed system.
In a distributed system, many processes may want to use a shared resource (printer, file,
database, etc.).To avoid conflicts, mutual exclusion is required.
A token-based approach uses a special message called a token.
Rule:
 A process can enter the critical section (CS) only if it has the token.
 Without token, it must wait.
Simple Definition:
Token = Permission to enter critical section
2. Two Important Properties of Token-Based Approach
(i) Uniqueness of Token
There must be only one token in the system.
Why?
 If more than one token exists, multiple processes may enter critical section at the
same time.
 This breaks mutual exclusion.
Result:
One token → One process in critical section
(ii) Token Availability / No Token Loss
The token must always be available in the system.
Why?
 If token is lost, no process can enter critical section.
 System stops working.
Result:
Token should circulate safely
3. Token-Ring Algorithm
Token-Ring is a distributed mutual exclusion algorithm based on token passing.
Processes are arranged in a logical ring.
A token moves from one process to the next in a circular order.
Only the process holding the token can enter the critical section.
4. Neat Diagram of Token-Ring Algorithm
P1 → P2
↑ ↓
P5 P3
← P4 ←
(Token moves in circular direction)
5. Working of Token-Ring Algorithm
Step 1: Ring Formation
All processes are arranged in a logical ring.
Example:
P1 → P2 → P3 → P4 → P5 → P1
Step 2: Token Circulates
A special token continuously moves in ring order.
Example:
P1 passes token to P2, P2 to P3, etc.
Step 3: Process Requests Critical Section
Suppose P3 wants to enter critical section
It waits until token arrives.
Step 4: Process Enters Critical Section
When P3 receives token:
 It enters critical section
 Uses shared resource
No other process can enter because only P3 has token.
Step 5: Token Passed to Next Process
After completing work:
P3 passes token to P4
Token continues circulating.
6. Example
Suppose ring:
P1 → P2 → P3 → P4
Current token at P2
 P2 uses critical section
 Passes token to P3
 P3 enters critical section if needed
 Then token moves to P4
Thus mutual exclusion is maintained.
7. Advantages of Token-Ring Algorithm
(i) Guaranteed Mutual Exclusion
Only token holder enters critical section.
(ii) No Starvation
Every process gets token in order.
(iii) Fairness
Processes get equal chance.
(iv) No Need for Broadcast Messages
Only token passing required.
8. Disadvantages of Token-Ring Algorithm
(i) Token Loss Problem
If token is lost, system stops.
(ii) Process Failure Problem
If one process fails, ring breaks.
(iii) Delay
A process may wait for token even if critical section is free.
Q10 Explain the goal of an Election algorithm. Illustrate the bully algorithm using
appropriate diagrams.
In a distributed system, one process is often selected as a coordinator (leader).
The coordinator performs special tasks such as:
 Resource management
 Synchronization
 Process coordination
 Failure handling
If the coordinator fails, the system must select a new coordinator.
This process is done by an Election Algorithm.
Simple Definition:
Election Algorithm = Method used to select a new coordinator in a distributed system

2. Goal of Election Algorithm


The main goal of an election algorithm is to choose one process as coordinator when the
current coordinator fails.
Objectives:
(i) Select a New Coordinator
Choose one process to control the system.
(ii) Detect Coordinator Failure
If coordinator crashes, election starts.
(iii) Maintain System Operation
System continues working even after failure.
(iv) Ensure Only One Coordinator
Avoid multiple leaders.
3. Bully Algorithm
The Bully Algorithm is a distributed election algorithm used to select the process with the
highest process ID as the coordinator.
Rule:
Highest ID process wins the election
Assumptions:
 Each process has a unique ID
 Every process knows IDs of others
 Failed processes do not respond
4. Working of Bully Algorithm (Using Given Diagram)
The given diagram shows:
 Processes P0, P1, P2, P3, P4, P5
 P5 has highest ID and is coordinator
 Suppose P5 fails
 Lower process starts election
Diagram Explanation
In the figure:
 P4 detects that coordinator P5 has failed
 P4 sends Election message to higher ID process (P5)
 No response comes (because P5 failed)
Then P4 becomes coordinator and informs others.
5. Steps of Bully Algorithm
Step 1: Failure Detection
A process detects that coordinator has failed.
Example:
P4 finds that P5 is not responding.
Step 2: Election Message
P4 sends Election message to all higher-ID processes.
Example:
P4 → P5
Step 3: Wait for Reply
 If higher process replies OK, it will take over election.
 If no reply comes, lower process wins.
In figure:
P5 does not reply.
Step 4: New Coordinator Selected
P4 becomes new coordinator.
Step 5: Coordinator Message
P4 sends Coordinator message to all lower processes.
Example:
P4 → P0, P1, P2, P3
Q11 Q2) a) What are the advantages of logical clock over physical clock? Consider Figure 1
that shows four processes (P1, P2, P3, P4) with events a, b, c, ... and messages
communicating between them. Assume that initial logical clock values are all initialized to
0. List the Lamport timestamps for each event shown in Figure 1. Assume that each
process maintains a logical clock as a single integer value as a Lamport clock. Provide
timestamps for each labeled event.

1. Advantages of Logical Clock over Physical Clock


A physical clock uses actual time (hours, minutes, seconds), while a logical clock uses event
ordering.
Advantages of Logical Clock:
(i) No Need for Clock Synchronization
 Physical clocks on different machines may differ.
 Logical clocks do not need exact global time.
(ii) Maintains Event Ordering
 Helps determine which event happened before another.
 Useful in distributed systems.
(iii) Avoids Clock Drift Problem
 Physical clocks run at different speeds.
 Logical clocks are based on events, so drift does not matter.
(iv) Simple to Implement
 Uses integer counters instead of real clock hardware.
(v) Suitable for Distributed Systems
 Provides causal ordering even when no common clock exists.
2. Lamport Clock Rules
Rule 1:
Before every event:
C=C+1
Rule 2:
If a process sends a message:
Attach current timestamp to message.
Rule 3:
If a process receives a message with timestamp Tm:
C = max(C, Tm) + 1
3. Lamport Timestamps for Given Figure
(Initial clocks of all processes = 0)
Process P1

Event Timestamp Reason

a 1 First event

b 3 Receives from m (2)

c 4 Next event

d 5 Next event

e 6 Receives from k (5)

f 9 Receives from p (8)

g 10 Next event

Process P2

Event Timestamp

h 1

i 2

j 4

k 5

l 8

Process P3

Event Timestamp

m 2

n 3

o 7

p 8

q 10

Process P4
Event Timestamp

r 2

s 3

t 6

u 7

4. Final Answer (All Event Timestamps)

Process Events with Lamport Timestamps

P1 a=1, b=3, c=4, d=5, e=6, f=9, g=10

P2 h=1, i=2, j=4, k=5, l=8

P3 m=2, n=3, o=7, p=8, q=10

P4 r=2, s=3, t=6, u=7

Q12 Consider the Figure 1 that shows four processes (P1, P2, P3, P4) with events a, b, c,...
and messages communicating between them. Assume that initial logical clock values are
all initialized to 0. List the Lamport timestamps for each event shown in Figure 1. Assume
that each process maintains a logical clock as a single integer value as a Lamport clock.
Provide timestamps for each labeled event.

Step-by-Step Timestamps
Initial clocks of all processes:
P1 = 0, P2 = 0, P3 = 0, P4 = 0
Process P1 (a, b, c, d, e, f, g)
 a = 1 (first event, sends to r)
 b = 2 (receives from h=1 → max(1,1)+1 = 2)
 c=3
 d=4
 e = 7 (receives from u=6 → max(4,6)+1 = 7)
 f = 8 (receives from p=5 → max(7,5)+1 = 8)
 g=9
Process P2 (h, i, j, k, l)
 h = 1 (first event, sends to b)
 i = 2 (receives from m=1 → max(1,1)+1 = 2)
 j = 4 (receives from s=3 → max(2,3)+1 = 4)
 k=5
 l = 8 (receives from v=7 → max(5,7)+1 = 8)
Process P3 (m, n, o, p, q)
 m = 1 (first event, sends to i)
 n = 3 (receives from i=2 → max(1,2)+1 = 3)
 o = 4 (receives from c=3 → max(3,3)+1 = 4)
 p=5
 q = 10 (receives from g=9 → max(5,9)+1 = 10)
Process P4 (r, s, t, u, v)
 r = 2 (receives from a=1 → max(0,1)+1 = 2)
 s=3
 t = 5 (receives from d=4 → max(3,4)+1 = 5)
 u=6
 v=7
Final Answer Table

Process Events with Lamport Timestamps

P1 a=1, b=2, c=3, d=4, e=7, f=8, g=9

P2 h=1, i=2, j=4, k=5, l=8

P3 m=1, n=3, o=4, p=5, q=10

P4 r=2, s=3, t=5, u=6, v=7

UNIT 4
Q1 With a neat diagram, explain the three types of replicas and their logical organization.
Replication means creating and storing multiple copies of data/files on different servers in
a distributed system.
These copies are called replicas.
Replication improves:
 Availability
 Reliability
 Performance
 Fault tolerance
Simple Definition:
Replication = Storing copies of data at multiple locations
2. Logical Organization of Replicas (Using Given Diagram)
 Permanent replicas → Fixed copies stored permanently
 Server-initiated replicas → Created by server when needed
 Client-initiated replicas → Created by client (cache copy)

A) Permanent Replicas
Permanent replicas are fixed copies of data stored permanently on servers.
These replicas always exist in the system.
Working:
 Original data is stored on Primary Server
 Permanent copies are stored on Replica Servers
 Client request can be served from these servers
Features:
 Always available
 Long-term storage
 Controlled by system administrator
Example:
 Google data centers
 Banking databases
Advantages:
 High availability
 Reliability
 Fault tolerance
B) Server-Initiated Replicas
These replicas are created by the server automatically when demand increases.
Server decides:
 Where to create copy
 When to create copy
 When to remove copy
Working:
1. Client requests file
2. Server notices high access demand
3. Server creates copy at another server
4. Future requests are served faster
Features:
 Controlled by server
 Temporary or dynamic
 Used for load balancing
Example:
 Content Delivery Networks (CDN)
Advantages:
 Faster access
 Reduced server load
 Better performance
C) Client-Initiated Replicas
These replicas are created by the client itself.
Client stores a local copy (cache) after receiving data.
Working:
 Client requests data from server
 Server sends data
 Client stores local copy in cache
 Next request uses cached copy
Features:
 Local temporary copy
 Controlled by client
 Improves response time
Example:
 Web browser cache
 Local file cache
Advantages:
 Faster access
 Less network traffic
 Reduced server load
Key Issues in Replica Management
Replica management deals with maintaining multiple copies (replicas) of data in a
distributed system. The main issues are:
1) Replica Placement
 Deciding where replicas should be stored in the network.
 Replica servers should be placed close to users for faster access.
Issue: Wrong placement increases delay and cost.
2) Consistency Management
 All replicas should contain the same updated data.
 If one copy changes, other replicas must also be updated.
Issue: Some replicas may contain old/outdated data.
3) Update Propagation
 Changes made to one replica must be sent to all other replicas.
Issue: Delay in sending updates causes inconsistency.
4) Synchronization
 Keeping all replicas synchronized with each other.
Issue: Network delays or failures may cause mismatched copies.
5) Fault Tolerance
 If one replica/server fails, another replica should continue serving users.
Issue: Need backup and recovery mechanisms.
6) Scalability
 Managing replicas efficiently when the system grows.
Issue: More replicas = more complexity in updates and management.
7) Replica Selection
 Deciding which replica should serve a client request.
Issue: Choosing a far or overloaded replica reduces performance.
8) Security and Access Control
 Protecting replicated data from unauthorized access.
Issue: Multiple copies increase security risks.

Q2 Discuss the two important reasons for wanting to replicate data and how does
replication relate to scalability.
Data replication means storing multiple copies of the same data on different servers or
locations in a distributed system.
These copies are called replicas.
2. Two Important Reasons for Replicating Data
A) Improve Reliability and Availability
One important reason for replication is to make data always available, even if a server fails.
Explanation:
Suppose data is stored on only one server.
If that server crashes:
 Data becomes unavailable
 System may stop working
But if copies are stored on multiple servers:
 Another server can provide data
 System continues working
Example:
Bank database stored on multiple servers.
If one server fails, backup server works.
Benefits:
 High availability
 Fault tolerance
 Better reliability
 Data backup
B) Improve Performance
Another reason is to increase speed of data access.
Explanation:
If all clients access one server:
 Server becomes overloaded
 Response becomes slow
If data is replicated:
 Clients can use nearest replica
 Load is shared
Example:
Video streaming websites store copies in many servers.
Users get data from nearest server.
Benefits:
 Faster response
 Reduced network traffic
 Better load balancing
 Improved user experience
3. How Replication Relates to Scalability
Scalability means the ability of a system to handle more users, more requests, and larger
data without performance loss.
Relation Between Replication and Scalability
Replication helps scalability because it distributes workload across many servers.
Explanation:
Without replication:
 One server handles all requests
 Server gets overloaded
 Performance decreases
With replication:
 Requests are divided among replicas
 Load is shared
 System supports more users
Example:
Suppose 10,000 users request same file.
Without replication:
One server handles all requests → slow
With replication:
Many servers share requests → faster
4. Replication Improves Scalability in Three Ways
(i) Load Distribution
Multiple replicas handle requests together.
This reduces burden on one server.
(ii) Better Read Performance
Clients can read data from nearest replica.
More users can access data at same time.
(iii) Geographic Scalability
Copies can be placed in different locations.
Users worldwide get faster access.
5. Limitation of Replication in Scalability
Replication improves read scalability, but updates become difficult.
Problem:
If data changes:
 All replicas must be updated
 Synchronization becomes complex
This is called consistency problem.
# How Are Replicas Kept Consistent?
Consistency means:
All copies shoul the same updated data
Problem:
Suppose original data changes.
If replicas are not updated:
 One server shows old data
 Another shows new data
This causes inconsistency.
Replicas are kept consistent by:
1. Update Propagation – Changes made in one replica are sent to all other replicas.
2. Synchronous Replication – All replicas are updated at the same time.
3. Asynchronous Replication – Updates are sent later after the main server is updated.
4. Synchronization Protocols – Special protocols ensure all copies match.
Main issue: Preventing outdated or conflicting copies.
Q3 Describe the following independent axes for defining inconsistencies with examples
(numerical deviation, staleness, ordering).
In a distributed system, data is often stored in multiple replicas (copies). When one copy is
updated, other copies may not update immediately. As a result, inconsistency occurs.
Inconsistency = Different replicas showing different values or states
To measure inconsistency, three independent axes are used:
1. Numerical Deviation
2. Staleness
3. Ordering
2. Numerical Deviation
Numerical deviation means:
Difference in data values between replicas
It measures how much the replica value differs from the latest correct value.
Example:
Suppose bank account balance:
 Original server = ₹10,000
 Replica server = ₹9,500
Difference:
₹10,000 – ₹9,500 = ₹500
So numerical deviation = ₹500
Importance:
Used when exact value matters in:
 Banking
 Stock market
 Inventory systems
3. Staleness
Staleness means:
How old or outdated a replica is compared to the latest data
It measures the time delay in update.
Simple Definition:
Staleness = Time difference between latest data and replica data
Example:
Suppose latest weather data updated at:
10:00 AM
Replica still shows data from:
9:55 AM
Difference:
5 minutes
So staleness = 5 minutes
Importance:
Important in:
 Real-time systems
 Online trading
 News updates
Memory Tip:
Staleness = “How old is the data?”
4. Ordering
Ordering means:
Updates must be seen in the correct sequence by all replicas
If updates arrive in wrong order, inconsistency occurs.
Simple Definition:
Ordering = Sequence of updates should remain correct
Example:
Suppose two updates:
1. Balance = ₹1000
2. Withdraw ₹200 → Balance = ₹800
Correct order:
₹1000 → ₹800
If replica gets updates in wrong order:
First ₹800, then ₹1000
Replica shows incorrect result.
This is ordering inconsistency.
Importance:
Important in:
 Banking transactions
 Messaging systems
 Distributed databases
Q4 What is the key issue in distributed system that supports replication? Differentiate
replica-server and content placement. Discuss ways to compute best placement of replica
servers.
1. Key Issue in Distributed Systems Supporting Replication
In distributed systems, replication means storing multiple copies of data on different
servers.
This improves:
 Performance
 Availability
 Reliability
But the main problem is:
Replica Management (Consistency and Placement)
Key Issue:
Keeping replicas consistent while deciding where replicas should be placed.
Explanation:
Suppose one copy of data is updated.
Then:
 All replicas must also be updated
 Otherwise some servers show old data
Also:
 Replicas should be placed in correct locations for better performance
So the key issues are:
1. Consistency management
2. Replica placement
Example:
Bank balance:
Main server = ₹10,000
Replica server = ₹9,000
This causes inconsistency.
2. Replica-Server Placement vs Content Placement
These are two different placement decisions in replication.
A) Replica-Server Placement
Replica-server placement means:
Deciding where to place the replica servers in the network
Focus:
Choosing:
 Which machines
 Which locations
 Which servers
should store replicas.
Example:
Company may place servers in:
 Mumbai
 Delhi
 Pune
to serve users faster.
Goal:
Reduce:
 Network delay
 Server load
 Access time
B) Content Placement
Content placement means:
Deciding what data should be stored on which replica server
Focus:
Choosing:
 Which file
 Which webpage
 Which video
should be stored on a specific replica server.
Example:
Popular movie stored in Pune server because many Pune users request it.
Goal:
Store the right content at right location.
3. Difference Between Replica-Server Placement and Content Placement

Replica-Server Placement Content Placement

Decides where replica servers should be Decides what data/content should be stored
placed in the network on replica servers

Focus is on server location Focus is on data placement

Helps reduce network delay and server load Helps improve data access speed

Example: Placing servers in Mumbai, Pune, Example: Storing popular video on Pune
Delhi server

4. Ways to Compute Best Placement of Replica Servers


The system uses different methods to decide the best location for replica servers.
A) Based on User Demand
Replicas are placed near areas where many users request data.
Example:
If many users in Pune request a file:
Replica server placed in Pune.
Benefit:
Faster access
B) Based on Network Distance
Replica servers are placed close to clients in terms of network path.
Goal:
Reduce communication delay.
Example:
Nearest server serves local users.
C) Based on Load Balancing
Replicas are placed where server load can be reduced.
Example:
If one server becomes overloaded:
Create replica on another server.
D) Based on Cost Analysis
Placement is decided by considering:
 Storage cost
 Communication cost
 Maintenance cost
Goal:
Best performance at low cost
E) Based on Access Frequency
Frequently accessed data gets more replicas.
Rarely used data gets fewer replicas.
Example:
Popular video → many replicas
Old file → fewer replicas
5. Objectives of Best Replica Placement
A good replica placement should:
 Reduce access time
 Reduce network traffic
 Improve scalability
 Improve availability
 Reduce server overload
Q5 What is checkpointing in a distributed system? Explain coordinated checkpointing
recovery mechanism.
In a distributed system, many processes run together. If a system crashes, all work may be
lost.
To avoid this, the system periodically saves its current state. This saved state is called a
checkpoint.
Example:
Suppose a process completes 70% work and crashes.
Without checkpoint → Start from beginning
With checkpoint → Restart from saved point
2. Need for Checkpointing
Checkpointing is used for:
 Failure recovery
 Saving system state
 Avoiding re-execution from start
 Improving reliability
3. Types of Checkpointing
Main types:
1. Coordinated Checkpointing
2. Uncoordinated Checkpointing
4. Coordinated Checkpointing
In coordinated checkpointing, all processes in the distributed system take checkpoints
together at the same time in a coordinated manner.
This creates one consistent global checkpoint.
5. Working of Coordinated Checkpointing Recovery Mechanism
Step 1: Coordinator Initiates Checkpoint
One process acts as coordinator.
It sends checkpoint request to all processes.
Step 2: All Processes Save State
Each process:
 Stops normal execution temporarily
 Saves its local state
Step 3: Messages Are Handled Carefully
Processes ensure that:
 No message is lost
 No inconsistent state occurs
Step 4: Global Checkpoint Created
All local checkpoints together form a consistent global checkpoint
Step 5: Failure Recovery
If system crashes:
 Processes roll back to last global checkpoint
 Execution resumes from saved point
7. Example
Suppose:
Processes:
P1, P2, P3
At time T:
Coordinator asks all to checkpoint.
Saved state:
 P1 = State A
 P2 = State B
 P3 = State C
Later system crashes.
Recovery:
All restart from saved states A, B, C
8. Advantages of Coordinated Checkpointing
(i) Consistent Recovery
Creates one correct global state.
(ii) No Domino Effect
Rollback does not continue indefinitely.
(iii) Easy Recovery
Simple restart from checkpoint.
(iv) Reliable
Suitable for distributed systems.
Q6 What is a primary-based protocol in a consistency protocol? Explain replicated write
protocols with active replication.
A primary-based protocol is a consistency protocol used in distributed systems where one
replica is selected as the primary server.
All write operations are first performed on the primary replica, and then the updated data is
sent to other replicas.
2. Working of Primary-Based Protocol
Step 1:
Client sends write request to primary server.
Step 2:
Primary server updates its own copy.
Step 3:
Primary sends updated data to backup replicas.
Step 4:
All replicas become consistent.
Diagram:
Client → Primary Replica → Replica 1
→ Replica 2
→ Replica 3
Example:
Suppose bank balance is stored on many servers.
 Client deposits ₹1000
 Request goes to primary server
 Primary updates balance
 New balance is copied to other replicas
3. Advantages of Primary-Based Protocol
 Easy to manage updates
 Maintains consistency
 Avoids write conflicts
5. Replicated Write Protocols
A replicated write protocol is used to ensure that all replicas are updated correctly when
data changes.
It controls how write operations are performed on multiple copies.
6. Active Replication
In active replication, the write operation is sent to all replicas at the same time.
Each replica performs the same operation independently.
7. Working of Active Replication
Step 1:
Client sends request.
Step 2:
Request is forwarded to all replicas.
Step 3:
All replicas perform same operation.
Step 4:
All replicas produce same result.
Diagram:
Replica 1

Client → Replica 2

Replica 3
(All replicas update together)
Example:
Suppose stock price changes.
Client sends update:
New price = ₹500
All replicas update at same time:
 Replica 1 = ₹500
 Replica 2 = ₹500
 Replica 3 = ₹500
8. Advantages of Active Replication
 High availability
 Fast recovery if one replica fails
 Strong consistency

Primary-Backup Protocol
Primary-backup protocol is a replication protocol in which one server acts as the Primary
Server (active) and another acts as the Backup Server (standby). The primary handles client
requests, while the backup keeps an updated copy of data.
Explanation using the given diagram
1. Client sends request to Primary Server
o As shown in the diagram (1. Request), the client sends its request to the
Primary Server (Active).
2. Primary forwards request to Backup Server
o The primary processes the request and sends the update to the Backup
Server (Standby) (2. Forward Request).
3. Backup sends acknowledgment (ACK)
o The backup updates its copy and sends an ACK back to the primary (2. Ack).
4. Primary replies to Client
o After receiving ACK from the backup, the primary sends the final response to
the client (3. Reply).
Diagram:

Failure Handling
 If the Primary Server fails, the Backup Server takes over and becomes the new
primary.
 This ensures fault tolerance and high availability.

Q7 Define data-centric consistency model. Explain causal consistency model with


example.
A data-centric consistency model defines the rules for how multiple replicas of shared data
should behave when read and write operations occur in a distributed system.
It ensures that users get correct and consistent data from different replicas.
Need for Data-Centric Consistency
In distributed systems:
 Data is stored in many replicas
 One replica may update before others
This may cause inconsistency.
Consistency models define how updates should be seen by users.
2. Causal Consistency Model
Causal consistency is a data-centric consistency model in which causally related operations
must be seen in the same order by all processes.
Simple Definition:
Cause before effect
If one event causes another event, all users must see them in that order.
3. Rule of Causal Consistency
If:
Write 1 influences Write 2
Then every process must see:
Write 1 before Write 2
If two writes are independent:
They may be seen in different order.
4. Example of Causal Consistency
Suppose in a chat application:
Step 1:
User A sends message:
“Hello”
(write W1)
Step 2:
User B reads “Hello” and replies:
“Hi”
(write W2)
Here:
W1 causes W2
So:
All users must see:
Hello → Hi
Correct order must be maintained.
Wrong order is not allowed:
Hi → Hello ❌
Because reply cannot come before original message.
5. Characteristics of Causal Consistency
 Maintains cause-effect relationship
 Correct event ordering
 Better than weak consistency
 Allows concurrent independent writes
6. Advantages
(i) Maintains logical correctness
Cause appears before effect.
(ii) Better consistency than weak models
(iii) Useful in messaging and social media systems
7. Disadvantages
(i) More complex to implement
(ii) Requires tracking dependencies
Q8 What is client-centric consistency model? Explain monotonic read consistency with
example.
A client-centric consistency model is a consistency model used in distributed systems where
the focus is on the view seen by a single client when accessing replicated data.
It ensures that a client gets a reasonable and consistent view of data, even if all replicas are
not immediately updated.
Need for Client-Centric Consistency
In distributed systems:
 Data is stored in many replicas
 Different replicas may have different versions
A client may read old data from one replica and new data from another.
Client-centric consistency avoids such problems.
2. Monotonic Read Consistency
Monotonic read consistency means:
If a client reads a data value once, then any future read by the same client should return the
same value or a newer value, but never an older one.
Simple Definition:
Once a client reads new data, it should never see older data again
3. Rule of Monotonic Read
If a client reads:
Version V2
Then next read must be:
 V2 again OR
 Newer version (V3, V4…)
But not older version (V1)
4. Example of Monotonic Read Consistency
Suppose a file has versions:
 V1 = Old version
 V2 = Updated version
Step 1:
Client reads from Replica A
Gets:
V2
Step 2:
Client moves to Replica B
Replica B still has:
V1
Without monotonic read:
Client sees:
V2 → V1 ❌
(Older data appears)
This is wrong.
With monotonic read:
System ensures client gets:
V2 → V2 or V3 ✔
Never older version.
Real-Life Example
Suppose you check your email:
 First login shows 10 new emails
 Later login should not show only 7 emails
You should see:
10 or more emails, not fewer.
This is monotonic read consistency.
Q9 What is fault tolerance? Explain transient, intermittent, permanent fault classes.
Explain types of failures.
1. Fault Tolerance
Fault tolerance is the ability of a distributed system to continue working correctly even if
some components fail.
It helps the system detect faults and recover without stopping the whole system.
Simple Definition:
Fault tolerance = Ability of system to continue operation after failure
Example:
If one server crashes, another backup server continues service.
2. Fault Classes
Faults are divided into three classes:
A) Transient Fault
A transient fault occurs for a short time and disappears automatically.
Features:
 Temporary fault
 Happens once
 System may recover automatically
Example:
 Temporary network failure
 Power fluctuation
B) Intermittent Fault
An intermittent fault occurs again and again at irregular intervals.
Features:
 Appears and disappears repeatedly
 Unpredictable fault
Example:
 Loose cable
 Occasional communication error
C) Permanent Fault
A permanent fault stays in the system until it is repaired.
Features:
 Continuous fault
 Needs repair or replacement
Example:
 Hard disk crash
 Burnt circuit
3. Types of Failures
A) Crash Failure
The system or process stops working completely.
Example:
Server crashes and stops responding.
B) Omission Failure
The system fails to send or receive messages.
Example:
Message lost in network.
C) Timing Failure
The system gives response too early or too late.
Example:
Missed deadline in real-time system.
D) Response Failure
System gives incorrect output.
Example:
Wrong calculation result.
E) Byzantine Failure
System behaves unpredictably and gives different wrong outputs.
Example:
Faulty server sending conflicting data.
Q10 What are the requirements of dependable systems with respect to fault tolerance?
How RPC handles communication failure (client cannot locate server, request lost).
A dependable system is a system that continues to provide correct service even when faults
occur.
To achieve this, fault tolerance is required.
2. Requirements of Dependable Systems (with respect to fault tolerance)
A dependable system should satisfy the following requirements:
A) Availability
The system should remain available and operational even if some components fail.
Example:
If one server crashes, backup server should continue service.
B) Reliability
The system should perform correctly for a long period without failure.
Example:
Banking system should work correctly without losing transactions.
C) Safety
System should avoid dangerous or incorrect results even during faults.
Example:
Medical system should not give wrong output.
D) Maintainability
Faults should be detected and repaired easily.
Example:
Failed server can be replaced quickly.
E) Fault Recovery
System should recover from faults and continue operation.
Example:
Using checkpointing and backup.
3. RPC (Remote Procedure Call)
RPC (Remote Procedure Call) allows a client to call a procedure on a remote server as if it
were a local function.
In communication, failures may occur.
RPC provides mechanisms to handle these failures.
4. Communication Failure in RPC
A) Client Cannot Locate Server
Problem:
Client sends request but cannot find the server because:
 Server crashed
 Wrong address
 Network issue
RPC Handling:
 Client contacts binder/name server
 If server not found, error is returned
 Client may retry later
Result:
RPC reports failure instead of hanging forever.
B) Request Message Lost
Problem:
Client sends request, but message is lost in network.
Server never receives it.
RPC Handling:
Step 1:
Client starts a timer
Step 2:
If reply does not come before timeout:
Client resends request
Step 3:
RPC may use sequence numbers to detect duplicate requests
Result:
Request is sent again and communication continues.
Q11 What is the distribution commit problem? Discuss how this problem is solved using
the two-phase commit protocol with diagram.
1. Distributed Commit Problem
In a distributed system, one transaction may execute on multiple sites (servers).
After execution, all sites must make the same final decision:
 Commit (save changes) OR
 Abort (cancel changes)
The problem is to ensure that all sites agree on one common decision, even if failures occur.
Problem Example:
Suppose money transfer:
 Server 1 deducts money
 Server 2 adds money
If one commits and another aborts:
Data becomes inconsistent.
So all must agree.
2. Two-Phase Commit Protocol (2PC)
The Two-Phase Commit Protocol solves the distributed commit problem.
It uses:
 Coordinator → controls transaction
 Workers/Participants → execute transaction
It works in two phases.

3. Diagram (Using Given Image)


Explanation of the Diagram:
The image shows:
Phase 1: Prepare Phase
 Coordinator sends prepare
 Worker replies ready
Phase 2: Commit Phase
 Coordinator sends commit
 Worker sends ack
4. Working of Two-Phase Commit Protocol
Phase 1: Prepare Phase (Voting Phase)
Step 1:
Coordinator sends prepare message to all workers.
(Shown as prepare in diagram)
Step 2:
Workers check if transaction can be completed.
They reply:
 Ready → if commit possible
 Abort → if commit not possible
(Shown as ready in diagram)
Phase 2: Commit Phase (Decision Phase)
Step 3:
If all workers reply ready
Coordinator sends:
Commit
Otherwise sends:
Abort
(Shown as commit in diagram)
Step 4:
Workers perform commit and send:
ACK
(Shown as ack in diagram)
Step 5:
Transaction completes.
5. Example
Suppose bank transaction:
Transfer ₹1000
Prepare Phase:
 Coordinator asks both bank servers
 Both reply ready
Commit Phase:
 Coordinator sends commit
 Both save changes
 Send ack
Transaction succeeds.

Q12 Discuss and compare “Push versus Pull Protocols” propagation design issue for
content distribution.
In distributed systems, when data is updated on one server, the changes must be
propagated (sent) to replicas.
There are two main propagation protocols:
1. Push Protocol
2. Pull Protocol
These are used in content distribution to keep replicas updated.
2. Push Protocol
In a Push Protocol, the server automatically sends updated data to replicas whenever data
changes.
Working:
Step 1:
Original server updates data.
Step 2:
Server immediately sends update to replicas.
Step 3:
Replicas update their copy.
Example:
News server updates breaking news and sends it immediately to all replica servers.
Advantages:
 Fast update propagation
 Better consistency
 Clients get latest data quickly
Disadvantages:
 More communication overhead
 Unnecessary updates may be sent
3. Pull Protocol
In a Pull Protocol, replicas request updates from the server when needed.
Server does not send updates automatically.
Working:
Step 1:
Server data changes.
Step 2:
Replica checks server after some time.
Step 3:
Replica requests updated data.
Example:
Web browser checks server for latest webpage version.
Advantages:
 Less communication overhead
 Efficient when updates are rare
Disadvantages:
 Updates may be delayed
 Replica may temporarily show old data
4. Comparison Between Push and Pull Protocols

Push Protocol Pull Protocol

Server automatically sends updates to replicas Replica requests updates from server

Update propagation is fast Update propagation is slower

Provides better consistency May show stale (old) data

High communication overhead Low communication overhead

Suitable when updates are frequent Suitable when updates are rare

Replicas receive updates immediately Replicas get updates only when they ask

May send unnecessary updates even if not needed Updates are sent only when required

Used in stock market, news alerts Used in web browsers, cache systems

UNIT 5
Q1 Describe the architecture of Sun Network File System in detail.
Sun Network File System (NFS) is a distributed file system developed by Sun Microsystems.
It allows users to access files stored on a remote server as if they were local files.
2. Architecture of Sun NFS (Using Given Diagram)
The given diagram shows that NFS follows a client-server architecture.
It has two sides:
 Client Side
 Server Side
Communication takes place using RPC/XDR messages.
3. Explanation of Given Diagram
A) Client Side
(i) System Call Interface
This is the interface through which user programs request file operations such as:
 Open
 Read
 Write
(ii) Virtual File System (VFS)
VFS provides a common interface for:
 Local file access
 Remote file access
Function:
 Checks whether file is local or remote
 Hides file location from user
(iii) Local File System
If file is local:
 VFS sends request to local file system
 File is accessed from local disk
(iv) NFS Client
If file is remote:
 VFS sends request to NFS client
Function:
 Converts file request into NFS request
 Sends message to server using RPC/XDR
(v) Local Disk
Stores local files of client machine.
B) Communication (RPC / XDR)
Client and server communicate through:
RPC (Remote Procedure Call)
Used to send file operation requests.
XDR (External Data Representation)
Used to convert data into standard format.
Function:
 Sends request from client to server
 Returns response from server to client
C) Server Side
(i) NFS Server
Receives request from NFS client.
(ii) Virtual File System (VFS)
Provides interface between:
 NFS server
 Local file system
(iii) Local File System
Accesses actual files stored on server disk.
(iv) Local Disk
Stores remote shared files.
4. Working of Sun NFS
Step 1:
User requests file through System Call Interface
Step 2:
VFS checks:
 Local file? → Local file system
 Remote file? → NFS client
Step 3:
NFS client sends request to server using RPC/XDR
Step 4:
NFS server receives request
Step 5:
Server accesses file from local disk
Step 6:
Response sent back to client
Step 7:
User accesses file as if it were local
Q2 Discuss the master-slave architecture of Hadoop Distributed File System along with
functions of its key components.
HDFS (Hadoop Distributed File System) is a distributed file system used to store very large
files across multiple machines in a Hadoop cluster.
It follows a Master-Slave Architecture.
Simple Definition:
HDFS = Distributed file storage system for big data
2. Master-Slave Architecture of HDFS
In HDFS:
 One node acts as Master (NameNode)
 Many nodes act as Slaves (DataNodes)
The client communicates with both for storing and retrieving data.
3. Explanation of Given Diagram
The diagram shows:
(i) Client
 Sends request to NameNode
 Reads/Writes data to DataNodes
(ii) NameNode (Master)
 Stores metadata
 Controls DataNodes
(iii) DataNodes (Slaves)
 Store actual data blocks
4. Key Components of HDFS
A) NameNode (Master)
NameNode is the main server of HDFS.
It manages the file system.
Functions:
 Stores metadata (file names, directory structure)
 Keeps record of which block is stored in which DataNode
 Handles client requests
 Controls replication
 Monitors DataNodes using heartbeat
Example from diagram:
NameNode keeps record like:
 file1 → Block1, Block2, Block3
 file2 → Block1, Block4
B) DataNode (Slave)
DataNodes are worker nodes.
They store actual file data.
Functions:
 Store file blocks
 Read/write data
 Send heartbeat to NameNode
 Send block reports
Example from diagram:
 DataNode 1 stores Block 1, 2, 4
 DataNode 2 stores Block 1, 3, 5
 DataNode 3 stores Block 2, 3, 4
Simple Memory Tip:
DataNode = Stores actual data
C) Client
Client is the user or application that accesses HDFS.
Functions:
 Sends metadata request to NameNode
 Reads/Writes data to DataNodes
Working:
Client first asks NameNode for file location, then directly accesses DataNodes.
5. Working of HDFS (Using Diagram)
Step 1:
Client sends metadata request to NameNode.
Step 2:
NameNode replies with block location.
Step 3:
Client directly reads/writes data from DataNodes.
Step 4:
DataNodes send:
 Heartbeat
 Block report
to NameNode.
Step 5:
Data blocks are replicated across DataNodes.
(Shown in diagram)
Q3 What are the key design issues for distributed file systems? Describe the requirements
for distributed file systems.
A Distributed File System (DFS) is a file system in which files are stored on multiple
computers but appear to users as a single file system.
2. Key Design Issues of Distributed File Systems
While designing a DFS, some important issues must be considered.
A) Naming and Transparency
Users should access files in the same way whether files are:
 Local
 Remote
Goal:
Hide file location from user.
B) File Sharing and Concurrency
Many users may access the same file at the same time.
Issue:
System must control:
 Multiple reads
 Multiple writes
to avoid conflicts.
C) Caching
Frequently used files are stored temporarily in cache.
Goal:
 Faster access
 Reduced network traffic
D) Replication
Multiple copies of files may be stored on different servers.
Goal:
 Better availability
 Fault tolerance
 Faster access
E) Consistency
If one copy of file changes, all replicas must be updated.
Goal:
All users should see correct data.
F) Fault Tolerance
System should continue working even if:
 Server fails
 Network fails
G) Security
Files should be protected from unauthorized access.
Security includes:
 Authentication
 Access control
 Data protection
H) Scalability
System should support:
 More users
 More files
 More servers
without performance loss.
3. Requirements of Distributed File Systems
A good DFS should satisfy the following requirements:
A) Transparency
Remote files should appear like local files.
B) Reliability
System should work correctly even if faults occur.
C) Availability
Files should be available whenever users request them.
D) Performance
File access should be fast.
E) Scalability
System should grow easily with increasing users and data.
F) Security
Only authorized users should access files.
G) Consistency
All users should see updated and correct file data.
H) Fault Recovery
System should recover from failures automatically.
Q4 What is a Directory Service? What is the difference between DNS and X.500? Describe
in detail the components of X.500 service architecture.

1. What is a Directory Service?


A Directory Service is a distributed database service used to store, organize, and provide
information about users, computers, resources, and services in a network.
It helps users find resources by name instead of physical location.
Example:
A telephone directory stores:
 Person name
 Phone number
 Address
Similarly, a directory service stores:
 User names
 Email addresses
 Printer details
 Server information
2. Difference Between DNS and X.500

DNS X.500

Stands for Domain Name System Standard Directory Service model

Converts domain name into IP address Stores detailed directory information

Simple naming service Full directory service

Uses hierarchical domain names Uses directory tree structure

Stores limited information Stores detailed user/resource data

Example: [Link] → IP address Example: User name, address, email

3. X.500 Service Architecture


X.500 is an international standard for directory services.
It uses a distributed client-server architecture.
5. Components of X.500 Service Architecture
A) User System
This is the client/user machine.
Function:
 Sends request to directory service
 Receives operation result
Example:
User searches for email address of a person.
B) DSA Interface (Directory System Agent Interface)
This is the communication interface between user and DSA.
It contains:
 Presentation layer
 Session layer
 Transport layer
Function:
 Handles communication between client and server
C) DSA (Directory System Agent)
DSA is the main server in X.500 architecture.
Function:
 Processes directory requests
 Searches directory database
 Communicates with other DSAs
D) Directory Information Base (DIB)
DIB is the directory database.
Function:
Stores directory entries such as:
 User name
 Address
 Email
 Organization
 Resource information
Example:
Like database of directory information.
E) Access Control
Controls who can access directory information.
Function:
 Authentication
 Security
 Permission checking
F) Another DSA
If requested information is not available in one DSA:
 Request is forwarded to another DSA
Function:
Supports distributed directory service.
G) Directory System Shadowing
Shadowing means keeping copies of directory information on multiple DSAs.
Function:
 Backup
 Faster access
 Fault tolerance
6. Working of X.500 Architecture
Step 1:
User sends request.
Step 2:
DSA Interface receives request.
Step 3:
DSA searches DIB.
Step 4:
If information not found, another DSA is contacted.
Step 5:
Access control checks permissions.
Step 6:
Result sent back to user.
Q5 Describe the design of a peer-to-peer download/file sharing system designed to
support very large multimedia files. How does the BitTorrent protocol operate?
1. Peer-to-Peer (P2P) File Sharing System
A Peer-to-Peer (P2P) file sharing system is a distributed system in which users (peers) share
files directly with each other without depending on one central server.
It is specially designed for sharing very large multimedia files such as:
 Movies
 Videos
 Software
 Games
2. Need for P2P for Large Multimedia Files
Large files create problems in client-server systems:
 Heavy server load
 Slow downloads
 High bandwidth usage
P2P solves this by allowing many users to share file parts.

4. Components of BitTorrent System


A) Tracker (Directory Server)
Tracker is a special server.
Functions:
 Keeps list of peers
 Tells new peer who has file pieces
 Coordinates file sharing
B) Seeder
Seeder is a peer that has the complete file.
Functions:
 Uploads file pieces to others
 Helps start sharing
Example:
A user with full movie file.
C) Peers
Peers are users downloading file.
Functions:
 Download file pieces
 Upload received pieces to others
Feature:
A peer is both:
 Client
 Server
D) Swarm
Swarm is the group of all peers sharing the same file.
Functions:
 Exchange file pieces among themselves
5. Working of BitTorrent Protocol (Using Diagram)
Step 1: Registration with Tracker
Seeder and peers register with tracker.
(Shown in diagram as Register with tracker)
Step 2: Tracker Returns Peer List
Tracker sends list of peers who have file pieces.
(Shown in diagram as Tracker returns peer list)
Step 3: File is Divided into Pieces
Large file is broken into many small pieces.
Example:
Movie file →
Piece 1, Piece 2, Piece 3 …
Step 4: Peers Exchange Pieces
Peers download different pieces from:
 Seeder
 Other peers
At the same time, they upload pieces to others.
(Shown in diagram as Peers exchange file pieces)
Step 5: Complete File Reconstructed
After receiving all pieces:
Peer becomes a Seeder
Q6 What are web services? Describe with a suitable diagram the general organization of
the Apache web server.
Web Services are software services that allow different applications to communicate and
exchange data over a network using web protocols.
They help different systems interact even if they are built in different languages or run on
different platforms.
Example:
 Online payment gateway
 Weather API
 Google Maps API
2. Features of Web Services
 Platform independent
 Language independent
 Uses web protocols (HTTP, XML, SOAP, REST)
 Supports application-to-application communication
3. General Organization of Apache Web Server (Using Given Diagram)
Apache Web Server is a popular web server that processes client requests and sends
responses.
The diagram shows the main organization of Apache Web Server.
4. Explanation of Given Diagram
The diagram contains:
1. HTTP Client (Web Browser)
2. Apache HTTP Server (httpd)
3. Apache Modules
4. BMMTM / Business Logic
5. Application Server / Backend Systems
5. Components of Apache Web Server

A) HTTP Client (Web Browser)


This is the user side.
Function:
 Sends HTTP/HTTPS request
 Receives HTTP/HTTPS response
Example:
Browser requests a webpage.
B) Apache HTTP Server (httpd)
This is the main server of Apache.
Function:
 Receives client request
 Processes request
 Sends response back
Simple Memory Tip:
Apache HTTP Server = Main request handler
C) Apache Modules
Apache supports modules such as:
mod_bmpapache (shown in diagram)
Function:
 Extend server capabilities
 Add extra services/features
Example:
Security, authentication, logging
D) BMMTM (Business Logic Layer)
This contains application logic.
Function:
 Processes application-related work
 Generates dynamic response
Example:
Login validation
E) Application Server (Backend System)
Backend server stores data and processes applications.
Communication with Apache:
 Proxy
 CGI
 Database (DB)
Function:
 Business processing
 Database access
 Dynamic content generation
6. Working of Apache Web Server
Step 1:
Client (browser) sends HTTP request
Step 2:
Apache HTTP Server receives request
Step 3:
Apache processes request using:
 Modules
 Business logic
 Application server
Step 4:
Backend system may access database or process request
Step 5:
Apache sends HTTP response back to client
7. Advantages of Apache Web Server
 Open source
 Supports modules
 Secure
 Handles dynamic content
 Platform independent
Q7 Describe, using the appropriate diagram, how a web service is implemented in
horizontal distribution using web server clusters.
Horizontal distribution means adding multiple web servers at the same level to handle
client requests instead of using a single server.
All servers work together as a web server cluster.

3. Explanation of Given Diagram


The diagram shows:
1. Client
2. Load Balancer
3. Web Server Cluster
4. Backend Services
5. External Services
6. Health Checks & Monitoring
4. Components of Horizontal Web Service Architecture
A) Client
Client may be:
 Web browser
 Mobile app
Function:
 Sends HTTP/HTTPS request
 Receives response
B) Load Balancer
Load balancer is placed between client and web servers.
Function:
 Receives client requests
 Distributes requests among multiple web servers
Example:
Sends request to:
 Web Server 1
 Web Server 2
 Web Server N
Benefit:
Prevents overload on one server.
Simple Memory Tip:
Load Balancer = Traffic manager
C) Web Server Cluster
A cluster contains multiple web servers working together.
Examples:
 Apache
 Nginx
Function:
 Process client requests
 Run web service application
 Share workload
Benefit:
If one server fails, others continue working.
Simple Memory Tip:
Cluster = Group of web servers
D) Backend Services
Web servers connect to backend systems such as:
 Database cluster
 Application server
 File/Object storage
Function:
Store data and process business logic.
E) External Services
Web service may use:
 Email service
 Payment gateway
 Third-party APIs
Function:
Provide additional services.
F) Health Checks & Monitoring
Monitors all servers continuously.
Function:
 Detect server failure
 Ensure high availability
5. Working of Horizontal Distribution
Step 1:
Client sends HTTP request.
Step 2:
Load balancer receives request.
Step 3:
Load balancer forwards request to one of the web servers in cluster.
Step 4:
Web server processes request.
Step 5:
Web server may access:
 Database
 Application server
 External services
Step 6:
Response sent back to client.
6. Advantages of Horizontal Distribution
 Better scalability
 Faster response
 Fault tolerance
 Load sharing
 High availability
Q8 Explain the Bandwidth, Latency and Loss rate parameters with respect to multimedia
stream. Explain the QoS negotiation procedure and admission control scheme for
distributed multimedia application

A multimedia stream is continuous transmission of data such as:


 Audio
 Video
 Live streaming
For good quality, certain network parameters are important.
These are called QoS (Quality of Service) parameters.
2. QoS Parameters for Multimedia Stream
A) Bandwidth
Bandwidth is the amount of data that can be transmitted through a network in one second.
Usually measured in:
 bps
 Mbps
Simple Definition:
Bandwidth = Data carrying capacity of network
Importance in Multimedia:
Video/audio streams require enough bandwidth.
If bandwidth is low:
 Video buffering
 Poor quality
Example:
HD video needs more bandwidth than audio call.
Simple Memory Tip:
Bandwidth = Speed of data transfer
B) Latency
Latency is the time taken for data to travel from sender to receiver.
Measured in:
 milliseconds (ms)
Simple Definition:
Latency = Delay in data transmission
Importance in Multimedia:
Low latency is needed for:
 Video calls
 Live streaming
 Online gaming
Problem if latency is high:
 Voice delay
 Video lag
Example:
During video call, delayed voice = high latency.
Simple Memory Tip:
Latency = Delay
C) Loss Rate
Loss rate is the percentage of data packets lost during transmission.
Simple Definition:
Loss Rate = Amount of data lost in network
Importance in Multimedia:
High packet loss causes:
 Broken audio
 Frozen video
 Poor streaming quality
Example:
Video pauses due to lost packets.
4. QoS Negotiation Procedure
QoS negotiation is the process of deciding whether the network can provide required
service quality for multimedia application.
Steps of QoS Negotiation
Step 1:
Application requests QoS requirements.
Example:
 Bandwidth = 5 Mbps
 Delay < 100 ms
 Low packet loss
Step 2:
Network checks available resources.
Step 3:
System compares:
Required QoS vs Available QoS
Step 4:
If resources available:
QoS request is accepted
Else:
Rejected or lower QoS offered
5. Admission Control Scheme
Admission control decides whether a new multimedia stream should be allowed into the
network.
Purpose:
Prevent network overload.
Working:
Step 1:
New multimedia request arrives.
Step 2:
System checks:
 Available bandwidth
 Current traffic
 Delay
 Packet loss
Step 3:
If enough resources available:
✔ Accept request
If not:
❌ Reject request
Example:
If network already busy:
New video stream may be rejected.
Simple Definition:
Admission control = Decide whether to allow new stream
6. Importance of Admission Control
 Prevent congestion
 Maintain QoS
 Improve multimedia quality
Q9 Why Quality of Service Management is important in Distributed Multimedia Systems?
Describe QoS manager responsibilities using suitable graphical representation.
QoS (Quality of Service) Management means maintaining the quality of multimedia services
such as:
 Video streaming
 Audio call
 Video conferencing
 Online gaming
It makes sure multimedia data is delivered smoothly.
2. Why QoS Management is Important in Distributed Multimedia Systems
Distributed multimedia systems send audio, video, and live data over a network.
These applications need:
 Fast delivery
 Low delay
 No packet loss
 Enough bandwidth
Without QoS management, multimedia quality becomes poor.
Importance of QoS Management
A) Maintains Good Audio and Video Quality
QoS ensures:
 Clear sound
 Smooth video
 No buffering
B) Reduces Delay (Latency)
Important for:
 Video calls
 Live streaming
Without QoS:
Voice and video may be delayed.
C) Prevents Packet Loss
Lost packets cause:
 Broken sound
 Frozen video
QoS reduces packet loss.
D) Provides Required Bandwidth
QoS reserves enough bandwidth for multimedia streams.
E) Prevents Network Congestion
Controls traffic and avoids network overload.
F) Supports Real-Time Applications
Needed for:
 Online meetings
 Live broadcasting
 Gaming
3. Suitable Graphical Representation of QoS Manager
Multimedia Application

QoS Manager
┌───────────────────┐
│ Resource Check │
│ QoS Negotiation │
│ Admission Control │
│ Monitoring │
│ Adaptation │
│ Synchronization │
└───────────────────┘

Network Resources

Audio / Video Output
4. Responsibilities of QoS Manager
A) Resource Reservation
QoS manager reserves resources like:
 Bandwidth
 CPU
 Buffer memory
Goal:
Provide required quality.
B) QoS Negotiation
QoS manager checks:
 What application needs
 What network can provide
Then decides service quality.
Example:
App asks:
 5 Mbps bandwidth
 Low delay
QoS manager checks availability.
Memory Tip:
Negotiation = Ask and decide quality
C) Admission Control
QoS manager decides:
Should new multimedia stream be allowed or not?
If resources available:
✔ Accept
If resources not available:
❌ Reject
D) Monitoring
QoS manager continuously checks:
 Delay
 Packet loss
 Bandwidth usage
Goal:
Maintain good quality during streaming.
E) Adaptation Control
If network becomes slow:
QoS manager adjusts quality.
Example:
Reduce video quality to avoid buffering.
Memory Tip:
Adaptation = Change quality when needed
F) Synchronization
Keeps:
 Audio
 Video
in proper timing.
Example:
Lip movement matches sound.
Q10 Explain in brief, the two places of client-side web caching? Explain cooperative
caching with suitable diagram.
Web caching is the process of storing copies of web pages or web objects temporarily so
that future requests can be served faster.
2. Two Places of Client-Side Web Caching
Client-side web caching can occur in two places:
A) Browser Cache (Local Cache)
This cache is stored in the client’s own web browser.
Working:
 When user visits a webpage for the first time, data is downloaded.
 Browser stores a copy locally.
 Next time, browser loads data from cache.
Advantages:
 Faster page loading
 Reduces network traffic
Example:
Previously visited webpage opens quickly.
Memory Tip:
Browser cache = Stored in user’s computer
B) Proxy Cache (Caching Server)
This cache is stored on a caching server between client and origin server.
(This is shown in the given diagram)
Working (Using Given Diagram)
First Request:
1. Client sends request to caching server
2. Cache forwards request to origin server
3. Origin server sends response
4. Cache stores response
Next Request:
1. Client sends request
2. Cache directly gives response
No need to contact origin server.
Advantages:
 Faster access
 Reduces server load
 Saves bandwidth
Memory Tip:
Proxy cache = Shared cache on network
3. Cooperative Caching
In cooperative caching, multiple cache servers share cached data with each other.
Before contacting origin server:
One cache checks other caches.
4. Diagram of Cooperative Caching

Working:
Step 1:
Client sends request to Cache 1
Step 2:
If data not found in Cache 1,
Cache 1 checks:
 Cache 2
 Cache 3
Step 3:
If found, data is sent to client
Else:
Origin server is contacted
5. Advantages of Cooperative Caching
 Reduces server load
 Faster response
 Better bandwidth usage
 Improves cache hit rate
UNIT 6
Q1 Explain the following in brief: Wearable devices, PVM, JINI.#3
Wearable devices are small smart electronic devices that can be worn on the body and
connected to a computer or network.
They collect information, process data, and provide services while the user is moving.
Examples
 Smart watch
 Fitness band
 Smart glasses
 Heart monitoring device
 Smart shoes
Features of Wearable Devices
A) Portable
Small and light, easy to wear.
B) Wireless Communication
Uses:
 Bluetooth
 Wi-Fi
 Internet
to send data.
C) Sensors
Collect information such as:
 Heart rate
 Steps
 Temperature
 Location
D) Real-Time Monitoring
Provides instant data to user.
Uses of Wearable Devices
 Health monitoring
 Fitness tracking
 Navigation
 Communication
 Medical applications
Example
A smart watch can:
 Count steps
 Measure heart rate
 Show messages
Advantages
 Easy to use
 Portable
Disadvantages
 Battery limitations
 Security/privacy issues
2. PVM (Parallel Virtual Machine)
PVM (Parallel Virtual Machine) is software that connects many computers through a
network and makes them work like one large parallel computer.
It is used for distributed and parallel computing.
Need for PVM
Some tasks need very high processing power.
Instead of one computer:
PVM uses many computers together.
Working of PVM
Step 1: Many computers are connected in a network.
Step 2: A large task is divided into smaller tasks.
Step 3: Each computer works on its part.
Step 4: Results are combined.
Components of PVM
A) Host Machine
Main computer controlling the work.
B) Slave Machines
Other computers helping in processing.
C) Message Passing
Computers communicate by sending messages.
Features of PVM
 Parallel processing
 Distributed computing
 Message passing
 Fault tolerance
Example
Weather forecasting:
Large calculations divided among many computers.
Advantages
 Faster execution
 Better resource utilization
 Low cost using existing computers
Disadvantages
 Network dependency
 Communication overhead
3. JINI
JINI is a Java-based distributed networking technology that allows devices and services to
join a network and automatically discover each other.
Need for JINI
In distributed systems:
Devices should connect and use services automatically without manual configuration.
JINI makes this possible.
Working of JINI
Step 1: A device joins the network.
Step 2: It registers its service.
Step 3: Other devices discover that service.
Step 4: Devices use the service automatically.
Example
Printer joins office network.
Users automatically find and use it.
Main Components of JINI
A) Service Provider
Device that provides service.
Example:
Printer
B) Lookup Service
Directory that stores available services.
C) Client
User/device that searches for service.
Features of JINI
 Service discovery
 Dynamic networking
 Java-based
 Automatic service registration
Advantages
 Easy service sharing
 Automatic device discovery
 Flexible distributed computing
Disadvantages
 Java dependency
 More complex setup
Q2 How wearable devices work in distributed systems? Discuss the problems involved
with wearable computing.#1

1. Wearable Devices in Distributed Systems


Wearable devices are smart electronic devices worn on the body that collect data and
communicate with other devices in a distributed system.
Examples:
 Smart watch
 Fitness band
 Health monitoring devices
2. Working of Wearable Devices in Distributed Systems (Using Given Diagram)
The diagram shows the following working:
Step 1: Sensors Collect Data
Body sensors collect information such as:
 Heart rate
 Blood pressure
 Motion
Step 2: Gateway / Body Unit
Sensor data is collected by Gateway (Body Unit).
Step 3: Smartphone / PDA
Gateway sends data to smartphone using:
 Bluetooth
 ZigBee
Step 4: Network Communication
Smartphone sends data through:
 Wi-Fi
 Mobile network (3G/4G)
to Internet.
Step 5: Distributed Processing
Data reaches:
 Medical Server
 Doctor
 Nurse
 Emergency services
for analysis and action.
Working Flow:
Sensors → Gateway → Smartphone → Internet → Doctor / Medical Server
3. Problems in Wearable Computing
A) Limited Battery Power
Wearable devices are small, so battery is limited.
Example:
Smart watch needs frequent charging.
B) Limited Processing Power
Wearables cannot do heavy processing.
Need cloud/server support.
C) Limited Storage
Wearables cannot store large data.
Need external storage.
D) Security and Privacy Issues
Wearables collect personal data such as:
 Health data
 Location
Risk of data theft
E) Network Dependency
Many services stop if network is unavailable.
F) Small Screen / User Interface
Wearables have small display and limited interaction.
G) Sensor Accuracy Problems
Wrong sensor readings may give incorrect results.
Q3 What is Service Oriented Architecture (SOA)? Explain the various SOA components.
How does it differ from traditional software architecture?#4
Service Oriented Architecture (SOA) is a software architecture in which an application is
divided into small independent services.
These services communicate with each other over a network to complete a task.
Example:
Travel booking system uses separate services for:
 Flight booking
 Hotel booking
 Payment
 Notification
2. Key Components of SOA (Using Given Diagram)
The diagram shows four main layers:
1. Consumers Layer
2. ESB Layer
3. Services Layer
4. Data Layer
3. Explanation of Components
A) Consumers Layer
This is the top layer.
It contains users who use the application.
Examples:
 Web application users
 Mobile app users
 Third-party cloud consumers
Function:
 Sends request
 Receives response
Example:
User searches for flight using mobile app.
B) Enterprise Service Bus (ESB)
ESB is the communication bus between users and services.
Function:
 Receives user request
 Sends request to correct service
 Connects different services
 Manages message routing
C) Services Layer (Service Providers)
This layer contains different independent services.
Shown in diagram:
(i) Flight Search Service
Searches available flights.
(ii) Hotel Search Service
Searches hotels.
(iii) Booking Service
Handles reservation.
(iv) Payment Service
Processes payment.
(v) Notification Service
Sends SMS/email confirmation.
Function: Each service performs a specific task.
D) Data Layer
This layer contains databases.
Shown in diagram:
 Flight DB
 Hotel DB
 Booking DB
 Payment DB
 User DB
Function: Stores data for services.
Example:
Flight search service accesses Flight DB.
4. Working of Travel Booking SOA Application
Step 1: User sends request through web/mobile app.
Step 2: Request goes to ESB.
Step 3:
ESB sends request to required service:
 Flight service
 Hotel service
 Booking service
Step 4: Service accesses database.
Step 5: Response sent back through ESB to user.
Example:
Book ticket:
User → ESB → Booking Service → Payment Service → Notification Service
5. Advantages of SOA
 Easy service reuse
 Flexible design
 Easy maintenance
 Scalable
 Services work independently

6. Difference Between SOA and Traditional Software Architecture


SOA (Service Oriented Architecture) Traditional Software Architecture

Application is divided into small independent Application is built as one big program
services (monolithic system)

Each service does one specific task All tasks are combined in one application

If one part fails, whole system may be


If one service fails, other services can still work
affected

Changing one part may affect whole


Easy to modify or update one service
application

Services can be reused in other applications Reuse of components is difficult

Communication happens through Components mostly communicate


network/messages (ESB, APIs) internally
SOA (Service Oriented Architecture) Traditional Software Architecture

More scalable (add more services easily) Less scalable (difficult to expand)

Maintenance is difficult because


Easy maintenance because services are separate
everything is connected

Q4 Explain in brief, the key features of Prometheus including data model, query language,
or alerting rules.#3
Prometheus is an open-source monitoring and alerting tool used to collect and monitor
system performance data.
It is commonly used in:
 Cloud systems
 Distributed systems
 Servers
 Applications
Example:
Prometheus can monitor:
 CPU usage
 Memory usage
 Server health
 Network traffic
2. Key Features of Prometheus
Prometheus has many important features.
A) Time-Series Data Model
Prometheus stores data as time-series data.
Example:

Time CPU Usage

10:00 40%

10:05 50%

10:10 60%

Feature:
Prometheus stores measurements over time.
B) Data Model
Prometheus data model stores information as:
Metric Name + Labels + Value + Timestamp
Example:
cpu_usage{server="server1"} = 75
Where:
 cpu_usage → metric name
 server="server1" → label
 75 → value
 Time stored automatically
Components of Data Model
(i) Metric Name
Name of measurement.
Example:
 cpu_usage
 memory_usage
(ii) Labels
Extra information about metric.
Example:
 server name
 job name
(iii) Value
Actual measured data.
Example:
75%
(iv) Timestamp
Time when data is collected.
C) PromQL (Query Language)
Prometheus uses a special query language called PromQL (Prometheus Query Language).
Uses:
 Search data
 Filter metrics
 Calculate averages
 Generate graphs
Example:
cpu_usage
Shows CPU usage.
avg(cpu_usage)
Shows average CPU usage.
Features:
 Powerful filtering
 Aggregation
 Mathematical operations
D) Alerting Rules
Prometheus can generate alerts when a condition becomes true.
Simple Definition:
Alerting Rules = Automatic warning when system problem occurs
Example:
Rule:
If CPU > 90%
Then:
Send alert
Working:
Step 1:
Prometheus checks metrics continuously
Step 2:
Condition matches alert rule
Step 3:
Alert is sent
Example Alerts:
 High CPU usage
 Server down
 Low memory
 Network failure
E) Pull-Based Monitoring
Prometheus collects data by pulling metrics from targets.
Working:
Prometheus asks servers for latest metrics.
Advantage:
Easy monitoring
F) Visualization Support
Prometheus data can be shown as:
 Graphs
 Dashboards
(using Grafana)
3. Advantages of Prometheus
 Real-time monitoring
 Easy alerting
 Powerful query language
 Good for cloud/distributed systems
 Time-series storage

Q5 Explain in brief, the key features of Zabbix (auto-discovery, triggers, dashboards).


1. What is Zabbix?
Zabbix is an open-source monitoring tool used to monitor:
 Servers
 Networks
 Applications
 Databases
 Cloud systems
It helps administrators check system health and performance.
Example:
Zabbix can monitor:
 CPU usage
 Memory usage
 Network traffic
 Server status
2. Key Features of Zabbix
Important features of Zabbix include:
1. Auto-Discovery
2. Triggers
3. Dashboards
A) Auto-Discovery
Auto-discovery is a feature that automatically finds devices and services in a network.
Working:
Step 1: Zabbix scans the network.
Step 2:
Finds devices such as:
 Servers
 Routers
 Switches
 Applications
Step 3: Adds them for monitoring automatically.
Example:
A new server is connected to network → Zabbix detects it automatically.
Advantages:
 Saves manual work
 Easy monitoring setup
 Detects new devices quickly
B) Triggers
Triggers are conditions or rules used to detect problems in monitored systems.
Working:
Step 1: Zabbix continuously checks system data.
Step 2:
If condition becomes true:
Trigger activates.
Example:
Rule:
If CPU usage > 90%
Then:
Alert generated.
Other Examples:
 Server down
 Low memory
 High temperature
 Network failure
Advantages:
 Detects problems quickly
 Sends alerts automatically
C) Dashboards
Dashboard is a graphical screen that shows monitoring data visually.
Features:
Dashboard shows:
 CPU graphs
 Memory usage
 Network traffic
 Alerts
 Server health
Example:
Admin sees all system information on one screen.
Advantages:
 Easy monitoring
 Quick understanding
 Graphical view
3. Advantages of Zabbix Features
 Automatic device detection
 Real-time alerts
 Easy graphical monitoring
 Reduces manual work
 Better system management
Q6 Explain in brief the following Distributed System monitoring tools: Zabbix, Nagios.
Nagios is an open-source monitoring tool used to monitor the health and performance of:
 Servers
 Networks
 Applications
 Distributed systems
It helps administrators detect problems and generate alerts.
Example:
Nagios can monitor:
 CPU usage
 Memory usage
 Network traffic
 Server availability
2. Working of Nagios
Nagios continuously checks system resources using plugins.
Step 1: Nagios sends monitoring request.
Step 2: Plugins check system condition.
Step 3: Nagios receives result.
Step 4: If problem found:
Alert is generated.
3. Key Features of Nagios
A) Monitoring
Nagios monitors:
 Servers
 Network devices
 Applications
 Services
Example:
Checks whether server is running or down.
B) Plugin-Based Monitoring
Nagios uses plugins to check system resources.
Plugins monitor:
 CPU
 Memory
 Disk
 Network
Example:
Plugin checks CPU usage.
C) Alerting System
Nagios sends alerts when problem occurs.
Example:
If server goes down:
Nagios sends email/SMS alert.
D) Reporting
Nagios creates reports about:
 System performance
 Uptime
 Downtime
Benefit:
Helps administrators analyze system health.
E) Dashboard
Nagios provides dashboard to show:
 Current status
 Alerts
 System health
Benefit:
Easy monitoring on one screen.
Comparison Between Prometheus, Zabbix, and Nagios

Feature Prometheus Zabbix Nagios

Monitoring and alerting Monitoring and Infrastructure


Type
tool management tool monitoring tool

Monitoring Pull-based (collects Agent-based / Plugin-based


Method metrics from targets) Agentless monitoring

Stores basic monitoring


Data Storage Time-series database Relational database
data

Strong auto-discovery
Auto-Discovery Limited Limited
support

Uses plugins and alert


Alerting Uses alerting rules Uses triggers
rules

Built-in graphical
Dashboard Basic (better with Grafana) Basic dashboard
dashboards

Query PromQL (powerful query No special query No special query


Language language) language language
Feature Prometheus Zabbix Nagios

Cloud, containers, Server and network


Best Used For Enterprise monitoring
distributed systems monitoring

Lower compared to
Scalability High scalability Medium to high
Prometheus

Ease of Setup Moderate Easy Moderate to difficult

Q7 Provide an overview of Mach and CHORUS microkernels. How are memory


management techniques used to avoid physical copying of data in Mach and CHORUS?
A microkernel is a small kernel that provides only essential services such as:
 Process management
 Memory management
 Communication (IPC)
Other services run outside the kernel.
Two important microkernels are:
1. Mach
2. CHORUS
2. Mach Microkernel
Mach is a microkernel developed at Carnegie Mellon University.
It is designed for:
 Distributed systems
 Parallel systems
 Multiprocessor systems
Main Features of Mach
 Message passing communication
 Virtual memory management
 Process and thread management
 Port-based communication
Working:
Mach uses ports and messages for communication between processes.
3. CHORUS Microkernel
CHORUS is a distributed microkernel designed for:
 Distributed computing
 Real-time systems
 Embedded systems
Main Features of CHORUS
 Supports distributed processing
 Message passing
 Virtual memory
 Object-based communication
Working:
CHORUS allows distributed processes to communicate and share services across network.
4. Comparison Between Mach and CHORUS

Mach CHORUS

Developed at Carnegie Mellon University Developed by CHORUS Systems

Mainly used for distributed and parallel Mainly used for distributed and real-time
systems systems

Uses objects/actors and messages for


Uses ports and messages for communication
communication

Strong support for virtual memory


Supports distributed object management
management

Uses Copy-on-Write (COW) to avoid copying Uses Page Remapping to avoid copying
data data

More suitable for research and academic More suitable for commercial and
systems embedded systems

Focuses on multiprocessor support Focuses on distributed system flexibility

IPC (Interprocess Communication) based on


IPC based on message/object mechanism
port mechanism

5. Problem of Physical Copying of Data


Normally, when one process sends data to another:
 Data is copied from sender memory
 Then copied again to receiver memory
This causes:
 More time
 CPU overhead
 Extra memory use
Problem:
Physical copying is slow and inefficient
6. Memory Management Technique in Mach (Copy-on-Write)
Mach avoids physical copying using:
Copy-on-Write (COW)
Working:
Step 1: Instead of copying data, Mach shares memory pages between processes.
Step 2: Both processes use same page.
Step 3: If one process modifies data:
Only then a new copy is created.
Benefit:
 Saves memory
 Faster communication
 Reduces copying
7. Memory Management Technique in CHORUS (Page Remapping)
CHORUS avoids copying using:
Page Remapping
Working:
Step 1: Instead of copying data, memory page mapping is changed.
Step 2: Receiver gets access to same page.
Benefit:
 No physical copying
 Faster message transfer
 Efficient memory use
8. Advantages of Avoiding Physical Copying
 Faster communication
 Less CPU overhead
 Better performance
 Saves memory
 Efficient distributed processing

You might also like