1
Distributed Computing Answers
Q.1) Explain issues in designing Distributed System.
Ans.) Issues in Designing a Distributed System (with Example)
A distributed system is like many computers working together as one team. Designing it is
difficult because of these issues:
1. Communication Problem
Computers communicate through a network. Messages may be delayed, lost, or reach in
wrong order.
Example: In WhatsApp, sometimes a message shows “sending” due to poor internet.
2. No Shared Memory
Each computer stores its own data. Data must be copied between machines.
Example: Google Docs saves copies on many servers so every user can see the same file.
3. Failure Handling
Any server or network can fail suddenly. The system must still work.
Example: If one Google server goes down, Gmail still works from another server.
4. Scalability
System should support more users without slowing.
Example: During online ticket booking, thousands of users connect at the same time.
5. Security
Data must be protected from hackers and unauthorized users.
Example: Online banking uses encryption so others cannot read your password.
6. Synchronization
All computers must agree on time and order of actions.
Example: In online exams, the timer must be same for all students.
7. Transparency
User should feel it is one single system.
Example: When you search on Google, you don’t know which server answered you.
8. Resource Sharing
Many users share files, printers, databases without conflict.
Example: College computers sharing one printer over network.
Simple one-line example to remember:
Google services (Gmail/Drive) are the best example of a distributed system where many
servers work together but users feel it is one single computer.
Q.2) Compare NOS and DOS.
Ans.) Compare NOS and DOS:
Imagine many computers connected together in a network.
2
• NOS (Network Operating System) = each computer works mostly on its own, but can
share files or printers with others.
• DOS (Distributed Operating System) = all computers work like one single big system.
Comparison
1. Basic Idea
o NOS: Every computer has its own operating system and identity.
o DOS: Users feel there is only one operating system controlling all machines.
2. Resource Sharing
o NOS: Resources like files or printers are shared manually using network
commands.
o DOS: Resources are shared automatically by the system itself.
3. User View
o NOS: User knows which computer he is using.
o DOS: User does not know or care which computer is doing the work.
4. Control
o NOS: Control is separate on each machine.
o DOS: Control is global and centralized logically.
5. Transparency
o NOS: Low transparency – network details are visible.
o DOS: High transparency – network details are hidden.
6. Example
o NOS: Windows with file sharing, UNIX network.
o DOS: Amoeba, Sprite, Google distributed systems.
7. Failure Handling
o NOS: If one machine fails, others are not affected much.
o DOS: System must handle failures carefully because all act as one.
3
One-Line Summary
• NOS = many computers connected.
• DOS = many computers behaving like one computer.
Q.3) Explain desirable features of global scheduling algorithm
Ans.) Desirable Features of a Global Scheduling Algorithm
A global scheduling algorithm decides which task should run on which computer in a
distributed system. For it to work well, it should have the following features:
1. Fairness
Every process should get a fair chance to use resources. No task should wait forever while others
keep running.
Example: If Node A runs Task T1 for one minute, the scheduler also gives time to Task T2 on
Node B instead of letting T1 run continuously.
2. Load Balancing
Work should be shared equally among all computers. If one machine is overloaded and another is
free, the algorithm should move some tasks to the free one.
Example: Node A has 5 tasks and Node C has none, so the scheduler shifts one task from A →
C.
3. Scalability
The algorithm should work properly even if the number of computers increases. It should not
slow down when the system becomes large.
Example: The same scheduler works for 5 computers today and also works smoothly when the
system grows to 50 computers.
4. Low Overhead
Scheduling should not use too much time, memory, or network communication. The algorithm
must be lightweight.
Example: To assign a task, the scheduler sends only 2 control messages instead of 20 messages.
5. Fault Tolerance
If one computer fails, the system should still continue working by shifting its tasks to other
computers.
Example: If Node B crashes while running Task T3, the scheduler restarts T3 on Node D
automatically.
6. Stability
4
The algorithm should not keep moving tasks again and again between machines, as this wastes
time.
Example: Task T4 is not moved repeatedly A → B → C; it is migrated only once when really
needed.
7. Fast Response Time
User tasks should start and finish quickly without long delays.
Example: A small task submitted by a user is immediately sent to a free node instead of waiting
in a long queue.
8. Adaptability
The algorithm should adjust according to changing conditions like new tasks, failures, or varying
load.
Example: When many new tasks arrive at night, the scheduler changes allocation to use all
available nodes.
Q.4) Explain the need of election algorithm
Ans.) Need of Election Algorithm
Imagine a group project where many students are working together, but one student must act as
the leader to coordinate everyone. In a distributed system, many computers (nodes) work
together, and one of them often needs to act as a coordinator. An election algorithm is used to
choose that coordinator.
Why it is needed:
1. To select a coordinator:
Distributed systems need one process to manage tasks like scheduling, synchronization,
or resource sharing. Election algorithms help choose this leader automatically.
Example: In an online exam system, one server must collect answers from all centers.
Election algorithm decides which server will act as the coordinator.
2. Failure recovery:
If the current coordinator crashes or stops working, the system must quickly choose a
new one to continue working without stopping.
Example: In a banking system, if the main transaction server fails, election algorithm
selects another server so money transfer continues without interruption.
3. No central control:
There is no single permanent master in distributed systems, so nodes must decide among
themselves who will lead.
Example: In a peer-to-peer file sharing network, computers themselves elect one node to
manage the file list since there is no fixed central server.
5
4. Fair decision making:
All processes get a chance to participate, and the node with the highest priority or ID
usually becomes the leader.
Example: In a sensor network, the node with highest battery power may be elected as
leader so weaker nodes are not overloaded.
5. System consistency:
A single coordinator avoids confusion, duplicate work, and conflicts between different
nodes.
Example: In railway ticket booking, election algorithm ensures only one server assigns
seat numbers to avoid double booking.
In simple words:
Election algorithms help distributed computers “choose a new boss” whenever the old boss
fails, so the system keeps running smoothly.
Q.5) Justify how Ricart–Agrawala’s algorithm optimized the message overhead in
achieving mutual exclusion
Ans.) Imagine this situation:
There are 5 friends and only one gaming PC.
Whoever wants to play must ask the others for permission so that two people don’t play at the
same time.
How Ricart–Agrawala works (simple story)
1. When one friend wants to play, he sends one message to every other friend:
“I want to use the PC.”
2. Each friend replies only once:
“Okay, you can use it.”
3. After getting replies from everyone, he starts playing.
That’s it — only ask once + reply once.
Why this is optimized (less messages)
1. Only 2 types of messages
• REQUEST → “I want the resource”
• REPLY → “You can use it”
6
There are no extra messages, no middle person, no repeated asking.
2. Total messages are very less
If there are N processes:
• Send N–1 requests
• Get N–1 replies
Total = 2(N–1) messages
Older algorithms like Lamport needed 3(N–1) messages → more network traffic.
3. No central coordinator
• There is no boss process to manage permissions.
• Everyone talks directly to each other → saves coordination messages.
4. No polling or waiting loops
• A process asks only once and waits for replies.
• It does not keep asking again and again → saves bandwidth.
5. Timestamp decides priority
• The one who asked first (using timestamp) gets the resource.
• So no arguments, no extra negotiation messages.
One-line simple justification
Ricart–Agrawala algorithm reduces message overhead because it uses only one request and
one reply per process, requires just 2(N–1) messages, has no coordinator, and avoids repeated
polling.
Q.6) What is Remote Procedure Call? Explain how transparency is achieved in RPC
Ans.) What is RPC? (Very Simple)
• Remote Procedure Call (RPC) means:
One computer asks another computer to run a function for it.
• The programmer writes:
result = add(5,3)
and it looks local, but actually the function runs on another machine.
7
Easy meaning:
RPC = “Call a function on another computer as if it is on your own computer.”
Simple Example from Distributed Computing
Example: Online Railway Booking System
• Your laptop = Client
• Railway server = Remote machine
When you click “Check Seat Availability”:
1. Your system calls a function → checkSeat(trainNo)
2. This function actually runs on the railway server.
3. Server checks database and returns result → “Seats Available”.
You never see the network work happening.
It feels like a normal button click → this is RPC.
How Transparency is Achived in RPC (Super Simple)
Transparency = user should not feel it is remote.
1. Location Transparency
• You don’t know where railway server is (Mumbai, Delhi).
• Still you call same function.
2. Access Transparency
• You call function normally like:
bookTicket()
• No networking code written by you.
3. Network Transparency
• RPC hides IP address, sockets, messages.
4. Data Transparency
• Your laptop and server may store data differently.
• RPC converts data automatically.
8
5. Failure Transparency
• If network fails, RPC retries so user is not affected.
1–2 Line Exam Definition
RPC:
Remote Procedure Call allows a program to execute a procedure on another computer in a
distributed system while hiding all network details.
One-Line DC Example to Write in Exam
“In a distributed banking system, the ATM machine calls withdraw() on the bank server using
RPC, and the user feels it is a local operation.”
Q.7) Explain various forms of message-oriented communication with suitable example
Ans.) Various Forms of Message-Oriented Communication
In distributed computing, computers talk to each other by sending messages over a network.
This is called message-oriented communication. Instead of directly sharing memory, systems
exchange information in the form of messages.
1. Persistent vs Transient Communication
a) Persistent Communication
• The message is stored until the receiver is ready.
• Even if the receiver is offline, the message is not lost.
• Example: Email or WhatsApp message – you get it whenever you come online.
b) Transient Communication
• The message is delivered only if both sender and receiver are active at the same time.
• If the receiver is offline, the message is lost.
• Example: Live phone call or video meeting.
2. Synchronous vs Asynchronous Communication
a) Synchronous Communication
• Sender waits until the receiver gets the message and replies.
9
• Like a real conversation where you wait for the answer.
• Example: Chat with typing indicator or RPC call.
b) Asynchronous Communication
• Sender sends the message and continues its work without waiting.
• Receiver can read it later.
• Example: SMS or email.
3. Message Passing Models
a) Direct Communication
• Sender directly sends message to a specific receiver using its address.
• Example: Sending a message to a friend’s phone number.
b) Indirect Communication (via mailbox/queue)
• Messages are sent to a common place like a mailbox.
• Receiver collects from there.
• Example: Messages stored in a message queue like RabbitMQ.
4. Queue-Based Communication
• Messages are stored in a queue in order.
• Useful when many senders and receivers exist.
• Example: Online shopping system where orders are placed in a queue and processed one
by one.
5. Publish–Subscribe Model
• Sender does not know receivers.
• Receivers “subscribe” to topics they like.
• Example:
o You subscribe to a YouTube channel and get notifications whenever a new video
is published.
10
Simple Summary
• Message communication can be stored (persistent) or live (transient).
• Sender may wait (synchronous) or not wait (asynchronous).
• Messages can be direct, via queue, or via publish-subscribe.
• Real-life examples: email, WhatsApp, online orders, YouTube notifications.
Q.8) What is logical clock? Why are logical clocks required in distributed systems? How
does Lamport synchronize logical clocks? Which events are said to be concurrent in
Lamport’s timestamp
Ans.) Imagine This Situation
You and your two friends:
• Rahul (Computer A)
• Aisha (Computer B)
• Sameer (Computer C)
are chatting in a group but no one’s watch shows the same time.
Rahul’s watch → 10:05
Aisha’s watch → 9:55
Sameer’s watch → 10:01
So if Rahul says:
“I sent message at 10:05”
Aisha says:
“I replied at 9:56”
It becomes confusing — whose message was first?
This is exactly the problem in distributed systems!
1. What is a Logical Clock? (Very Simple)
Logical clock is like:
“A fake time number used only to decide order of events.”
11
It does NOT show real time like 10:30 AM.
It only shows:
✔ which event happened first
✔ which happened later
2. Why Logical Clocks are Needed?
Because in distributed systems:
• Computers are in different places
• Their real clocks don’t match
• Messages take time to reach
So real time cannot be trusted.
Logical clocks solve this confusion and keep events in correct order.
3. How Lamport Logical Clock Works (Easy Steps)
Every computer keeps a number called counter = C
Rule 1 – When something happens inside a computer
Increase counter by 1.
Example:
Rahul writes a file → C becomes 1
Rahul sends message → C becomes 2
Rule 2 – When sending message
Send the counter value with the message.
Rahul sends:
“Hello” + timestamp 2
Rule 3 – When receiving message
Receiver does:
12
New clock = max(own clock, received clock) + 1
Example
Aisha clock = 1
She receives Rahul message with timestamp = 2
Aisha will do:
max(1,2) + 1 = 3
Now Aisha clock becomes 3.
This keeps everyone in correct order.
4. What are Concurrent Events?
Concurrent =
Events that have NO relation with each other.
Example:
• Rahul is listening to music
• Aisha is drawing on her laptop
• No messages between them
These events are independent.
So Lamport says:
✔ They are CONCURRENT
✔ We cannot say which happened first.
Final in Super Simple Lines
• Logical clock = artificial time to order events
• Needed because real clocks in distributed systems are unreliable
• Lamport method:
1. Increase clock on every event
2. Send clock with message
13
3. On receive → max + 1
• Concurrent events = events with no message link.
Q.9) Explain Chandy–Misra–Haas algorithm for distributed deadlock detection
Ans.) Chandy–Misra–Haas Algorithm
1. First understand the basic idea
• Deadlock = circular waiting
• If P1 waits for P2, P2 waits for P3, and P3 waits for P1,
then no one can proceed → deadlock.
The algorithm only checks one thing:
“Is there a waiting cycle?”
2. What the algorithm uses
It uses a message called PROBE.
PROBE format:
PROBE (initiator, sender, receiver)
• initiator → process that started checking
• sender → process sending the probe
• receiver → process receiving the probe
Technical Example (Simple but correct)
Given system state (Wait-For Graph)
• P1 is waiting for a resource held by P2
• P2 is waiting for a resource held by P3
• P3 is waiting for a resource held by P1
P1 → P2 → P3 → P1
All processes are blocked.
Step-by-step working
14
Step 1: Deadlock detection starts
• P1 is blocked, so it starts detection.
• P1 sends:
PROBE (P1, P1, P2)
Step 2: P2 receives probe
• P2 is blocked.
• P2 forwards probe to the process it is waiting for (P3):
PROBE (P1, P2, P3)
Step 3: P3 receives probe
• P3 is blocked.
• P3 forwards probe to the process it is waiting for (P1):
PROBE (P1, P3, P1)
Step 4: Probe returns to initiator
• P1 receives:
PROBE (P1, P3, P1)
• Receiver = Initiator
Cycle detected
Deadlock confirmed
Why this works
• Probe follows the exact waiting path
• If the path comes back to the starting process,
→ circular wait exists
→ deadlock exists
15
Important rules to remember (exam points)
• Only blocked processes forward probes
• Unblocked process ignores probe
• Deadlock is detected only when probe returns to initiator
• No global knowledge is required
One-line exam answer
Chandy–Misra–Haas algorithm detects distributed deadlock by sending probe messages along
wait-for dependencies and declaring deadlock when the probe returns to the initiating process.
Q.10) Explain different load estimation and process transfer policies used by load
balancing algorithms.
Ans.) 1. Load Estimation Policies
Load estimation means: How does a computer decide whether it is busy or free?
Different ways to estimate (measure) load are:
1. CPU Usage
o Checks how much the CPU is being used.
o If CPU usage is high → system is busy.
o If CPU usage is low → system is free.
2. Number of Processes
o Counts how many programs (processes) are running.
o More processes → heavier load.
3. Queue Length
o Checks how many tasks are waiting to be executed.
o Long queue → system is overloaded.
4. Memory Usage
o Measures how much RAM is being used.
o If memory is almost full → system is busy.
5. Combination of Factors
16
o Uses CPU, memory, and queue length together.
o Gives a more accurate idea of load.
2. Process Transfer Policies
Process transfer means: When and how should a task be moved from one computer to another?
(a) Transfer Initiation Policy
Decides who starts the transfer.
1. Sender-Initiated
o Busy computer sends its task to a free computer.
o Example: “I’m overloaded, please take some work.”
2. Receiver-Initiated
o Free computer asks for work from a busy computer.
o Example: “I’m free, give me some work.”
(b) Selection Policy
Decides which task should be moved.
1. New Process
o Newly created task is transferred.
o Easy and safe to move.
2. Running Process
o A task already running is moved.
o More complex and costly.
(c) Location Policy
Decides where to send the task.
1. Random Selection
o Sends task to any random computer.
17
2. Least-Loaded Selection
o Sends task to the computer with the least work.
(d) Information Policy
Decides how load information is collected.
1. Periodic
o Load info is shared after fixed time intervals.
2. On-Demand
o Load info is requested only when needed.
3. State-Change Driven
o Load info is sent when system changes from busy to free or vice-versa.
3. Simple Summary
• Load estimation → finding how busy a computer is.
• Process transfer policies → deciding when, which, and where to move tasks.
• Goal → share work equally so all computers work efficiently.
Q.11) Describe code migration issues in detail
Ans.) Meaning :
Code migration means moving a running program (code) from one computer (machine) to
another in a distributed system. While doing this, many problems (issues) can occur.
1. Heterogeneity Issue
• Different computers may have different hardware, operating systems, or processors.
• A program written for one type of machine may not run correctly on another.
• Example: Code running on Windows may face problems when moved to Linux.
2. State Transfer Issue
18
• A running program has a state (variables, memory data, execution point).
• Transferring this state correctly to another machine is difficult.
• If the state is not transferred properly, the program may restart or give wrong results.
3. Resource Dependency Issue
• The program may depend on local resources like files, printers, or databases.
• After migration, these resources may not exist or may have different paths.
• This can cause the program to fail.
4. Security Issue
• Migrated code can be harmful if it is malicious.
• The destination system must protect itself from viruses or unauthorized access.
• Similarly, the code must be protected from being modified by the host system.
5. Performance Overhead
• Moving code over the network takes time and bandwidth.
• If migration happens frequently, it can slow down the system.
• Sometimes the cost of migration is higher than its benefit.
6. Compatibility Issue
• Libraries or software versions available on the source machine may not be present on the
destination machine.
• This can cause runtime errors after migration.
7. Failure Handling Issue
• If the network fails during migration, the code may be lost or duplicated.
• Proper mechanisms are required to recover safely from such failures.
19
Conclusion :
Code migration is useful for load balancing and flexibility, but it faces problems related to
compatibility, security, resources, and performance. These issues must be handled carefully to
ensure smooth execution in distributed systems.
Q.12) Discuss and differentiate various client consistency models
Ans.) Imagine many people using the same online notebook from different computers.
Client consistency models decide what each user (client) is allowed to see and when
after someone edits the notebook.
1. Strong Consistency
• All clients always see the same, latest data.
• Once data is updated, everyone sees it immediately.
• ✔ Very accurate
• ✘ Slow and hard to maintain in large systems
Example: Bank balance after a transfer — everyone must see the exact updated amount.
2. Sequential Consistency
• All clients see updates in the same order, but not necessarily immediately.
• The update may be delayed, but order is preserved.
• ✔ Easier than strong consistency
• ✘ Still some delay
Example: WhatsApp messages appear in the same order for everyone, but may arrive
late.
3. Causal Consistency
• Only related updates must be seen in the correct order.
• Unrelated updates can be seen in any order.
• ✔ Faster than sequential
20
• ✔ More flexible
Example: You see a reply message only after seeing the original message.
4. Eventual Consistency
• Clients may see different values temporarily.
• If no new updates happen, all clients eventually see the same data.
• ✔ Very fast
• ✔ Used in large systems
Example: Like count on Instagram — numbers may differ briefly, but become same
later.
5. Client-Centric Consistency
• Focuses on what one client sees, not all clients together.
• Ensures a user gets a reasonable and predictable view of data.
• ✔ Good for mobile and cloud users
Example: You always see your own latest post when you refresh.
Differentiation Table
Consistency Model What Client Sees Speed Example
Strong Always latest data Slow Bank systems
Sequential Same order of updates Medium Chat apps
Causal Related updates in order Fast Social media replies
Eventual Data becomes same over time Very fast Likes, views
Client-Centric Consistent for one user Fast Cloud storage
Types of Applications :
1. Banking & Financial Applications
• Need Strong Consistency
21
• Example: ATM, online banking
• Reason: Balance must be correct every time.
2. Chat & Messaging Applications
• Use Sequential or Causal Consistency
• Example: WhatsApp, Telegram
• Reason: Messages should appear in proper order.
3. Social Media Applications
• Use Eventual Consistency
• Example: Instagram likes, Facebook comments
• Reason: Speed is more important than exact count.
4. Cloud Storage Applications
• Use Client-Centric Consistency
• Example: Google Drive, Dropbox
• Reason: User must see their own latest uploaded file.
5. Online Shopping / E-commerce
• Use Mixed Consistency
• Example: Amazon
• Reason: Stock count may be eventual, payment must be strong.
Q.13) Explain Absolute ordering and Causal ordering process with the help of example for
many-to-many communication
Ans.) 1) Absolute Ordering (Total Ordering)
Meaning
Absolute ordering means all messages are received by all computers in exactly the same
order, no matter who sent them or when they were sent.
Think of it like a class notice board:
Everyone sees notices in the same sequence.
Many-to-Many Example
Suppose 3 computers are chatting in a group:
22
• P1, P2, P3 (all can send and receive messages)
Messages sent:
• P1 sends message M1
• P2 sends message M2
• P3 sends message M3
Absolute Ordering Rule
All computers must receive messages in one common order, such as:
• M1 → M2 → M3
OR
• M2 → M1 → M3
But the order must be identical everywhere.
So:
• P1 receives: M1, M2, M3
• P2 receives: M1, M2, M3
• P3 receives: M1, M2, M3
Key Point
✔ Same order at all nodes
✔ Used in banking systems, online reservations, distributed databases
2) Causal Ordering
Meaning
Causal ordering ensures that cause-and-effect messages are received in the correct order.
If one message causes another message, then everyone must see the cause before the effect.
Think of it like WhatsApp replies:
• You must see the question before the reply.
Many-to-Many Example
Again, computers:
23
• P1, P2, P3
Steps:
1. P1 sends message M1:
"Exam is postponed"
2. After seeing M1, P2 sends M2:
"Great news!"
3. P3 also sends M3 independently:
"Anyone has notes?"
Causal Ordering Rule
• M1 must be received before M2 everywhere
• M3 can be received anytime, since it is unrelated
Valid receiving order at P3:
• M1 → M3 → M2
• M3 → M1 → M2
Invalid:
• M2 → M1 (reply before message)
Key Point
✔ Only related messages follow strict order
✔ Unrelated messages can be in any order
✔ Used in chat applications, collaborative systems
3) Comparison (Quick Memory Tip)
Feature Absolute Ordering Causal Ordering
Order requirement Same order everywhere Only cause-effect order
Strictness Very strict Less strict
Performance Slower Faster
Example Bank transactions Group chat messages
24
One-Line Exam Conclusion
• Absolute ordering maintains a single global order of all messages.
• Causal ordering maintains only the logical cause-and-effect order of messages.
Q.14) List desirable features of distributed file system. How are modifications propagated
in file caching schemes?
Ans.) 1) Desirable Features of a Distributed File System (DFS)
A Distributed File System lets many computers share files as if they are on one computer.
Desirable features:
1. Transparency
o User should not know where the file is stored.
o Files appear local even if they are on another computer.
2. Sharing
o Many users can read or write the same file at the same time.
3. Scalability
o System should work well even when more users or computers are added.
4. Fault Tolerance
o If one computer crashes, files should still be available from others.
5. Consistency
o All users should see the same latest data in a file.
6. Security
o Only authorized users can access or modify files.
7. High Performance
o Files should open and save quickly.
2) How Are Modifications Propagated in File Caching Schemes?
File Caching (Simple Idea)
Imagine a school notes file stored on the school server.
Students keep a copy (cache) of this file on their own computers so they can open it faster.
25
Now, when one student edits the file, the change must reach others.
This is called modification propagation.
Main Methods:
1) Write-Through (Immediate Update)
What happens?
• As soon as you edit the file, the change is sent to the main server.
Example:
• You correct a spelling mistake in notes.
• The server is updated immediately.
• Other students always see the latest notes.
Easy line to remember:
✔ Safe and correct
A bit slow
2) Write-Back (Delayed Write)
What happens?
• Changes are saved only on your computer first.
• Server is updated later.
Example:
• You edit notes and close your laptop.
• Server still has the old notes.
• If your laptop crashes, changes may be lost.
Easy line to remember:
✔ Fast
Risky
3) Invalidate on Write
What happens?
26
• When you modify the file, others’ copies are marked invalid.
Example:
• You update chapter 3 notes.
• Other students get a message: “Your copy is outdated”.
• They must download the new file again.
Easy line to remember:
✔ Avoids wrong data
Needs reloading
4) Update on Write
What happens?
• When you edit the file, all copies are updated automatically.
Example:
• You add a new example in notes.
• Instantly, every student’s copy shows the new example.
Easy line to remember:
✔ Everyone sees same data
Uses more network
One-Line Summary
• Write-through: update server immediately
• Write-back: update server later
• Invalidate on write: mark other copies invalid
• Update on write: update all copies immediately
Q.15) Discuss Raymond’s tree-based algorithm of token-based distributed mutual exclusion
Ans.) Raymond’s Tree-Based Token Algorithm (Distributed Mutual Exclusion)
Idea in simple words:
Imagine many computers want to use a shared resource (like a printer). To avoid fights, only the
27
computer holding a special token is allowed to use it. Raymond’s algorithm uses a tree
structure to pass this token smartly.
Basic Concept
• All computers (nodes) are arranged in a logical tree.
• Only one token exists in the entire system.
• The node holding the token can enter the critical section.
• If a node does not have the token, it asks its parent for it.
How the Algorithm Works
1. Initially, the token is with the root of the tree.
2. When a node wants to enter the critical section:
o It sends a request message to its parent.
3. Each node keeps:
o A request queue (who is asking for the token).
o A pointer to the node from which it expects the token.
4. Requests move up the tree until they reach the node holding the token.
5. The token then travels down the tree along the request path.
6. After using the critical section:
o The node passes the token to the next requesting node.
Example (Easy)
• Think of a family tree.
• Only the person holding the key (token) can enter a room.
• If a child wants the key, they ask their parent.
• The request goes upward until it reaches the person holding the key.
• The key is passed down to the requester.
28
Advantages
• Fewer messages compared to broadcast algorithms.
• Efficient for large distributed systems.
• No deadlock, because only one token exists.
Disadvantages
• If the token is lost, the system stops.
• Tree structure must be maintained.
• Failure of a node can disturb the tree.
Conclusion (Exam-friendly)
Raymond’s tree-based algorithm is a token-based distributed mutual exclusion algorithm that
uses a logical tree to control access to the critical section efficiently by passing a single token
among requesting nodes.
Q.16) Explain how Monotonic Read consistency model is different from Read Your Write
consistency model.
Ans.) Difference between Monotonic Read Consistency and Read-Your-Write Consistency
In distributed systems, consistency models define how updates and reads behave when data is
stored on multiple servers.
1. Read-Your-Write Consistency
This model ensures that after you write something, you will always see your own update in
future reads.
Example:
If you update your WhatsApp status, and then refresh your status page, you will always see the
new status, not the old one.
Meaning in simple words:
“Once I change something, I will never see the old version again.”
29
2. Monotonic Read Consistency
This model ensures that once you read a newer version of data, you will never go back to
reading an older version later.
Example:
If you read a news article and see updated information, the system will not later show you the
older outdated article.
Meaning in simple words:
“Once I see new data, I will never see older data again.”
Key Difference
Read-Your-Write Monotonic Read
Ensures you see your own updates Ensures you see newer data after reading it once
Focused on your write operations Focused on your read order
Guarantees no old data after your write Guarantees no going backward in data versions
One-line difference (for exams)
Read-Your-Write consistency ensures a user always sees their own updates, while Monotonic
Read consistency ensures that once a user sees newer data, they will not see older data again.
Q.17) What is 1:M and M:1 group communication?
Ans.) 1 : M Group Communication (One-to-Many)
• In 1 : M communication, one process or computer sends a message to multiple
processes or computers at the same time.
• The sender does not need to send separate messages to each receiver; a single message is
delivered to all group members.
• All receivers get the same information simultaneously, which saves time and network
resources.
• This type of communication is also called broadcast or multicast communication.
• Example: A teacher announcing exam dates to all students in a class group.
• Use in distributed systems:
30
o Sending system updates
o Sharing configuration information
o Broadcasting alerts or notifications
M : 1 Group Communication (Many-to-One)
• In M : 1 communication, multiple processes or computers send messages to a single
process or computer.
• One receiver collects data or messages from many senders.
• Each sender may send different information, but all messages go to the same
destination.
• This type of communication is useful when information needs to be gathered or
analyzed at one place.
• Example: Many students submitting assignments to one teacher.
• Use in distributed systems:
o Collecting results from different machines
o Gathering logs or feedback
o Sending data to a central server for processing
Q.18) Differentiate between NOS, DOS, and Middleware in the design of distributed
systems.
Ans.) Example: School Computer Lab
Imagine a school computer lab with 10 computers connected together.
1. Network Operating System (NOS) – Like separate students
Example:
Each computer in the lab works independently.
• Every computer has its own OS.
• If you want a file from another computer, you must manually access it.
• You clearly know which computer you are using.
31
Real-life feeling:
Like 10 students sitting together, but each doing their own work.
Technical meaning:
• Computers are connected, but not unified.
2. Distributed Operating System (DOS) – Like one super computer
Example:
All 10 computers work together as one single system.
• You log in once and use the system.
• You don’t know or care which computer is doing the work.
• The system automatically shares memory, CPU, and files.
Real-life feeling:
Like 10 brains working as one brain.
Technical meaning:
• Multiple machines behave like one big computer.
3. Middleware – Like a translator/helper
Example:
Each computer has its own OS, but a helper software allows them to talk and share data.
• Computers remain separate.
• Middleware helps applications communicate.
• Used for sending messages, sharing data, security, etc.
Real-life feeling:
Like a teacher helping students share notes easily.
Technical meaning:
• Middleware sits between OS and applications.
32
One-Line Memory Trick
• NOS → Connected but separate
• DOS → Many systems act as one
• Middleware → Software that helps systems talk
Q.19) What is fault tolerance? Explain failure models.
Ans.) What is Fault Tolerance?
Fault tolerance is the ability of a distributed system to continue working correctly even when
some parts of the system fail.
In a distributed system, many computers (nodes) work together over a network. If one computer
crashes, a message is lost, or a network link fails, the system should not completely stop.
Instead, it should detect the problem and recover automatically or keep working using other
components.
Example:
Think of a group project. If one student is absent, the project still gets completed because others
take over. That is fault tolerance.
In short:
Fault tolerance means “the system does not fail even if some components fail.”
Failure Models in Distributed Systems
A failure model describes how a system or its components can fail. Understanding failure
models helps designers build fault-tolerant systems.
1. Crash Failure Model
33
In this model, a system component stops working suddenly and does nothing after that.
• The component does not send messages
• It does not respond
• It simply crashes and stays silent
Example:
A computer suddenly shuts down due to power failure.
Key Point:
The system knows the component has stopped completely.
2. Omission Failure Model
In this model, a component fails to send or receive messages.
There are two types:
• Send omission: Message is not sent
• Receive omission: Message is not received
Example:
A message sent over the network is lost due to congestion.
Key Point:
The component is alive, but communication fails.
3. Timing Failure Model
In this model, a component responds too late or too early.
• Response is correct
• But it comes outside the expected time
Example:
A server sends the correct reply, but it arrives too late to be useful.
Key Point:
This failure is common in real-time systems where time is important.
4. Response Failure Model
34
In this model, a component gives a wrong response.
There are two types:
• Value failure: Incorrect data is returned
• State transition failure: Component behaves incorrectly
Example:
A bank server shows wrong account balance.
Key Point:
The system is running, but the output is wrong.
5. Byzantine Failure Model
This is the most dangerous failure model.
• A component behaves unpredictably
• It may send wrong, conflicting, or random information
• It may act like an attacker
Example:
A hacked computer sending false data to other computers.
Key Point:
Failures are random and difficult to detect.
Summary (For Quick Revision)
• Fault tolerance: Ability of a system to work correctly even when failures occur.
• Crash failure: Component stops completely.
• Omission failure: Messages are lost.
• Timing failure: Response comes too early or too late.
• Response failure: Wrong output is given.
• Byzantine failure: Random, malicious, or unpredictable behavior.
Extra:
Information about components:
35
What is a Component? (very simple)
A component is one part of a system that does a specific job.
In distributed systems, a component can be:
• A computer / server
• A program or service
• A process running on a machine
• A network link
Easy Example (for a 15-year-old)
Think of a mobile phone:
• Screen → one component
• Battery → one component
• Camera → one component
If one component fails (like the battery), the phone doesn’t work properly.
In Distributed Computing
A distributed system is made of many components working together.
If one component fails, fault tolerance helps the system continue working.
One-line exam definition
A component is an individual part of a distributed system that performs a specific function.
Q.20) Explain code migration and its techniques.
Ans.) Code Migration:
Code migration means moving a running program (code) from one computer to another
over a network so it can continue its work there.
Instead of sending data to the program, we send the program to where the data or
resources are.
Example:
Imagine you’re doing homework on your laptop, but your friend’s computer is much faster. You
carry your notebook and continue work on your friend’s computer. That’s code migration.
Why Code Migration is Needed
36
• To use faster computers
• To access local data or devices
• To reduce network traffic
• To balance load among systems
Techniques of Code Migration
There are two main techniques:
Weak Migration
Meaning:
Only the program code is moved — not its current state.
What moves?
• Program code
Program execution state (variables, stack, current line)
What happens?
• Program restarts from the beginning on the new machine.
Simple Example:
You close a game on one phone and start it again on another phone — you lose progress.
Features:
• Easy to implement
• Less overhead
• Program restarts execution
Strong Migration
Meaning:
Both the program code and its execution state are moved.
What moves?
• Program code
37
• Current variables
• Program counter
• Stack and heap
What happens?
• Program continues from the exact point where it stopped.
Simple Example:
You pause a video on one phone and resume it from the same point on another phone.
Features:
• More complex
• Needs OS and language support
• No loss of execution progress
Comparison (Easy to Remember)
Weak Migration Strong Migration
Only code moves Code + state move
Program restarts Program resumes
Simple Complex
Less overhead More overhead
One-Line Exam Definition
Code migration is the process of transferring program code, and sometimes its execution state,
from one system to another in a distributed environment.
Q.21) Explain Bully election algorithm with suitable example.
Ans.) Bully Election Algorithm
The Bully Election Algorithm is used in a distributed system to select a new coordinator
(leader) when the current coordinator fails or crashes.
38
Each process (computer) in the system has a unique ID number.
Higher ID = higher priority.
The basic idea is:
“The process with the highest ID becomes the coordinator.”
It is called Bully because a higher-ID process can bully lower-ID processes and take control.
How the Bully Algorithm Works (Simple Steps)
1. Coordinator fails
o A process notices that the coordinator is not responding.
2. Election message sent
o That process sends an ELECTION message to all processes with higher IDs.
3. Response from higher ID
o If a higher-ID process is alive, it replies with OK and starts its own election.
4. No response case
o If a process gets no reply from any higher-ID process, it declares itself the new
coordinator.
5. Coordinator announcement
o The new coordinator sends a COORDINATOR message to all other processes.
Suitable Example (Very Easy)
Assume 5 processes in a system:
Process ID
P1 1
P2 2
P3 3
P4 4
P5 5
39
P5 (ID = 5) is the current coordinator.
Step 1: Coordinator Fails
• P5 crashes.
Step 2: Election Starts
• P2 notices failure and sends ELECTION message to P3, P4, and P5.
Step 3: Higher IDs Respond
• P3 and P4 reply OK.
• P5 does not respond (it is crashed).
Step 4: New Election
• P4 now sends ELECTION message to P5 only.
• No response received.
Step 5: New Coordinator Selected
• P4 declares itself as Coordinator.
• P4 sends COORDINATOR message to P1, P2, and P3.
P4 becomes the new coordinator.
Key Points (For Exam)
• Used to elect a coordinator in distributed systems.
• Highest ID process always wins.
• Works well when systems are small to medium sized.
• Requires more messages, so it is not very efficient.
• Assumes all processes know each other’s IDs.
Q.22) Explain Raymond’s algorithm for mutual exclusion(Q.15)
Q.23) What are different data-centric consistency models?
Ans.) Data-Centric Consistency Models
40
In Distributed Computing, the same data is stored on many computers (nodes).
A data-centric consistency model tells us how and when all users see the same data.
Think of it like a WhatsApp group opened on many phones.
Consistency rules decide who sees which message and when.
1. Strict Consistency
• Every user always sees the latest updated data immediately.
• No delay at all between update and visibility.
• Very hard to implement in real systems.
Example:
If one person changes a value, everyone sees it at the exact same moment.
2. Sequential Consistency
• All users see updates in the same order, but not necessarily immediately.
• Order is important, not exact time.
Example:
If A updates first and B updates second, everyone sees A’s update before B’s update.
3. Causal Consistency
• Only related updates must be seen in the same order.
• Unrelated updates can appear in different orders.
Example:
If you reply to a message, people must see the original message before the reply.
4. FIFO (PRAM) Consistency
• Updates from one user are seen in the same order by everyone.
• Updates from different users may appear in different orders.
Example:
Your messages appear in correct order, but messages from others may mix.
41
5. Weak Consistency
• Data is not always consistent.
• Updates become visible only at special times (like synchronization).
Example:
Game scores update only after the game round ends.
6. Release Consistency
• Data is consistent only when a lock is released.
• Used in systems with shared resources.
Example:
Changes are visible only after you finish editing and save.
7. Eventual Consistency
• If no new updates happen, all copies eventually become the same.
• Most common in real systems.
Example:
On social media, likes may differ for a few seconds but later match everywhere.
Summary (Easy Memory Trick)
Model Main Idea
Strict Always latest data
Sequential Same order for all
Causal Cause before effect
FIFO One user’s order preserved
Weak Updates later
Release Update after unlock
42
Model Main Idea
Eventual Same data after some time
EXTRA TO REMEMBER:
Data-Centric Consistency Models (Very Simple)
In distributed systems, same data is stored on many computers.
Consistency models decide when everyone sees the same data.
1. Strict Consistency
• Everyone sees the latest data instantly.
Think: Live score updating everywhere at the same time.
2. Sequential Consistency
• Everyone sees updates in the same order.
• Small delay is allowed.
Think: Messages come in same order for all.
3. Causal Consistency
• Related actions are seen in correct order.
• Unrelated actions don’t matter.
Think: Question → Answer (answer can’t come first).
4. FIFO Consistency
• Updates from one user are in order.
• Different users’ updates may mix.
Think: Your chats stay in order.
5. Weak Consistency
43
• Data updates sometimes, not always.
Think: Game score updates after a round.
6. Release Consistency
• Data updates after unlock / save.
Think: Others see changes after you click Save.
7. Eventual Consistency
• Data becomes same after some time.
Think: Likes count matching later on all phones.
One-Line Memory Tip
Strict → Fast | Sequential → Order | Causal → Reason | FIFO → User order | Weak → Later |
Release → After save | Eventual → Finally same
Q.24) What are physical clocks? Explain any one physical clock synchronization algorithm.
Ans.) What are Physical Clocks?
• A physical clock is the real clock that shows actual time (hours, minutes, seconds).
• Examples:
Wall clock
Wrist watch
System clock in a computer
In Distributed Systems:
• Every computer (node) has its own physical clock.
• These clocks do not run exactly at the same speed.
• So, clocks may show different times, which creates problems.
Why is this a problem?
• Events may be recorded in the wrong order.
• Logs, transactions, and coordination become confusing.
44
• Hence, clocks must be synchronized.
Physical Clock Synchronization
Clock synchronization means making all computers show almost the same correct time.
Cristian’s Algorithm (Physical Clock Synchronization)
Let’s explain this with an easy real-life idea
Basic Idea:
• One computer acts like a time server (it has the correct time).
• Other computers ask it for the correct time.
Steps of Cristian’s Algorithm:
1. Client sends a request
o A computer (client) asks the time server:
“What time is it?”
2. Server replies
o The time server sends back its current time.
3. Client calculates delay
o The client notes how long the message took to travel.
o It assumes half of that time was delay.
4. Client sets its clock
o Client sets its clock to:
Server Time + Network Delay
Simple Example:
• Client asks time at 10:00:00
• Server replies with time 10:00:10
45
• Message delay = 2 seconds
• Client adjusts time to:
10:00:11
Now the client clock is almost correct.
Advantages of Cristian’s Algorithm
• Easy to understand
• Simple to implement
• Works well for small systems
Disadvantages
• Depends heavily on the network delay
• If the server fails, synchronization fails
• Not suitable for very large distributed systems
Short Exam-Friendly Summary
• Physical clocks represent real-world time in computers.
• Due to clock drift, clocks in distributed systems differ.
• Cristian’s Algorithm synchronizes clocks using a time server.
• Client adjusts its time using server time and network delay.
Q.25) What are different issues and goals related to distributed systems?(Q.1)
Q.26) Explain file caching schemes.
Ans.) File Caching Schemes
Imagine your computer is doing homework from a big library far away (the server).
Every time you need a page, going to the library takes time.
So, your computer keeps copies of frequently used pages nearby — this is called file caching.
Now, file caching schemes are just different ways to store and manage these copies.
46
Client-side Caching
• Files are stored on the user’s computer.
• When the same file is needed again, it is read from the local cache instead of the server.
• This makes access faster and reduces network load.
Example:
Opening the same PDF notes again without downloading them every time.
Server-side Caching
• Files are cached on the server itself.
• Frequently requested files are kept ready in memory.
• Helps when many users request the same file.
Example:
A university website keeping syllabus files ready because many students download them.
Write-through Caching
• Whenever a file is changed, it is updated both in cache and on the server immediately.
• Ensures data is always correct.
• Slightly slower but safer.
Example:
Saving an assignment updates both your local copy and Google Drive at the same time.
Write-back (Delayed Write) Caching
• Changes are first made only in the cache.
• Updates are sent to the server later.
• Faster but risk of data loss if the system crashes.
Example:
Typing notes offline and syncing them later.
47
Consistency-based Caching
• Ensures all cached copies are up-to-date.
• Server checks whether cached data is still valid.
• Prevents users from seeing old data.
Example:
WhatsApp refreshing messages so everyone sees the latest chats.
Why File Caching is Important
• Faster file access
• Less network traffic
• Better system performance
In short:
File caching schemes decide where files are stored, when they are updated, and how
correctness is maintained in distributed systems.
Q.27) Write a short note on Replication and the types of replication.
Ans.)
Replication means making multiple copies of the same data or service and storing them on
different computers (nodes) in a distributed system.
The main idea is simple: if one copy fails, others are still available.
Think of it like saving your notes on phone, laptop, and Google Drive — even if one device
fails, your notes are safe.
Why Replication is used
• Improves reliability (system keeps working even if one server fails)
• Improves availability (data is always accessible)
• Improves performance (users get data from the nearest copy)
• Provides fault tolerance
Types of Replication
48
1. Active Replication
o All replicas process the same request at the same time
o Every copy stays exactly the same
o Used in systems where high accuracy is needed
Example: Bank transaction systems
2. Passive Replication (Primary–Backup)
o One main server (primary) handles requests
o Other servers (backups) only update when primary changes
o If primary fails, a backup becomes the new primary
Example: Database backup systems
3. Synchronous Replication
o Data is updated on all replicas at the same time
o Very safe but slower
o No data loss
Example: Financial systems
4. Asynchronous Replication
o Data is updated on the main server first
o Replicas are updated after some time
o Faster but small data loss is possible
Example: Social media apps
Conclusion
Replication means keeping extra copies of data to make systems safe, fast, and reliable.
Different types are used based on speed and safety needs.
Extra for UNDERSTANDING:
What is Replication? (Very simple)
Replication = making copies
In distributed computing, replication means keeping the SAME data on many computers.
49
Example:
You write notes →
• one copy in your notebook
• one photo in your phone
• one copy on Google Drive
If you lose one → you still have the notes.
That is replication.
Why do we do Replication?
1. If one computer fails → system still works
2. Data is always available
3. System becomes faster
4. Data is safe
Types of Replication (Explained like to a 15-year-old)
Active Replication
All copies work together
• Every computer gets the same work
• All copies stay the same
Example:
Teacher writes homework on 3 boards at the same time
All boards show the same thing.
✔ Very safe
Needs more work
Passive Replication (Primary–Backup)
One main copy, others are backups
• One computer does all the work (main)
50
• Others just keep copies
• If main fails → backup takes over
Example:
You play a game on phone
Backup saved on cloud
✔ Simple
✔ Commonly used
Synchronous Replication
Update all copies at the same time
• Data saved everywhere together
• No data loss
Example:
You send a message → it must reach all friends before moving on
✔ Very safe
Slow
Asynchronous Replication
Update main first, copies later
• Main copy updated first
• Other copies updated after some time
Example:
WhatsApp message →
sent first, delivered later
✔ Fast
Small delay possible
Q.28) What is RPC? Explain the working of RPC in detail.
51
Ans.) RPC (Remote Procedure Call)
RPC is a communication method that allows a program to call a function (procedure) on
another computer over a network as if it were a normal local function call.
In simple words: Your program asks another computer to do some work, and it feels like
calling a function on your own computer.
Why RPC is needed (simple idea)
Imagine:
• Your computer needs some data or service.
• That service is on another computer (server).
• Instead of writing complex network code, RPC hides all network details and makes it
look like a normal function call.
Working of RPC (Step-by-Step, very simple)
1. Client calls a procedure
• The client program calls a function.
• Example: getStudentMarks(rollNo)
• The client thinks this function is local.
2. Client Stub (Helper)
• The call actually goes to a client stub.
• Client stub is a small helper program.
• It packs the function name and parameters into a message.
• This packing is called marshalling.
3. Request sent over network
• The packed request is sent to the server machine using the network.
52
4. Server Stub receives request
• On the server side, the server stub receives the message.
• It unpacks the data (called unmarshalling).
• It understands which function to call and with what values.
5. Actual procedure executes
• The server executes the real function.
• Example: Server finds the student marks.
6. Result sent back
• The result is packed by the server stub.
• It is sent back to the client over the network.
7. Client receives result
• Client stub unpacks the result.
• The value is returned to the client program.
• To the client, it feels like a normal function returned a value.
Key Features of RPC
• Transparency: Network details are hidden.
• Simple programming: Looks like normal function call.
• Client–Server model is used.
• Uses marshalling and unmarshalling for data transfer.
Real-Life Example (For a 15-year-old)
Think of ordering food by phone:
• You (client) call a restaurant (server).
• You just say what you want.
53
• You don’t care how the kitchen works.
• Food is prepared and delivered back.
• RPC works the same way — request goes, result comes back.
Why RPC is useful (in one line)
RPC lets one computer use functions of another computer easily, without knowing network
details.
One-line definition (Very easy)
RPC allows a program on one computer to call a function on another computer as if it were a
local function.
Example:
Imagine this situation
• Your computer (Client) is very weak.
• Your friend has a powerful computer (Server).
• You want your friend’s computer to do a calculation for you.
Example: Finding Square of a Number
Client calls a function
On your computer, you write:
square(5)
You think this function is on your own computer.
Client Stub (Messenger)
• The client stub acts like a messenger.
• It packs the message:
o Function name → square
o Value → 5
54
• Sends it over the network.
Message goes through network
• The message travels from your computer to your friend’s computer.
Server Stub receives message
• The server stub opens the message.
• It understands:
o “Run function square with value 5”
Server runs the function
On the server computer:
square(5) = 25
Result sent back
• Server stub packs the answer 25
• Sends it back to your computer.
Client gets the answer
• Client stub receives 25
• Gives it to your program
• You see the result:
Output = 25
To you, it feels like your own computer did the work, but actually another computer did it.
Q.29) Explain key features of Global Scheduling algorithm(Q.3)
Q.30) What are the services offered by middleware?
55
Ans.) Services offered by Middleware (explained simply )
Think of middleware as a translator + helper that sits between applications and the operating
system/network, so different computers can work together easily.
Here are the main services, in very simple language:
1. Communication Service
Middleware helps computers talk to each other (send and receive messages) even if they
are far away.
2. Naming Service
Just like saving a contact name instead of remembering a phone number, middleware lets
programs find other programs using easy names.
3. Security Service
It protects data by checking who is allowed to use the system (login, passwords,
permissions).
4. Transaction Service
Ensures that important tasks (like bank transfers) are completed fully or not at all,
avoiding mistakes.
5. Concurrency Control Service
Helps many users work at the same time without causing errors (like many people
editing data safely).
6. Persistence Service
Allows data to be saved and recovered later, even if the system crashes.
7. Fault Tolerance Service
If something goes wrong (server failure), middleware keeps the system running or
recovers automatically.
8. Location Transparency Service
Programs don’t need to know where another program is running; middleware handles it.
In short:
Middleware makes distributed systems easy, safe, and reliable to use—without
programmers worrying about network details.
Who uses Middleware? (simple answer)
Middleware is used by:
56
1. Software Developers
They use middleware to build apps without worrying about networking, security, or
failures.
2. Large Companies / Organizations
Banks, e-commerce companies, airlines, hospitals use it to connect many systems
together.
3. Web & Mobile Applications
Apps like Amazon, Netflix, Google, Paytm use middleware to handle users, payments,
and data.
4. Distributed Systems
Cloud systems, microservices, and client-server applications rely on middleware to work
smoothly.
In one line (exam-friendly):
Middleware is used by developers and organizations to connect applications in distributed
systems.
Q.31) Differentiate between RMI and RPC.
Ans.) Differentiate between RMI and RPC
Think of two computers talking to each other over a network. Both RMI and RPC help them
do this, but in different ways.
RPC (Remote Procedure Call)
• RPC is like asking another computer to run a function for you.
• You just say “Do this work” and get the result back.
• It does not care about objects, only functions/procedures.
• Mostly used in C, C++ programs.
• Programmer must handle more details (data formats, communication).
Example:
You ask a friend, “Add these two numbers and tell me the answer.”
RMI (Remote Method Invocation)
• RMI is like calling a method of an object that lives on another computer.
57
• It works only with Java.
• It supports objects and object-oriented programming.
• Easier for Java developers because Java handles many things automatically.
Example:
You tell your friend, “Use your calculator object and call its add() method.”
Key Differences (Easy Table)
RPC RMI
Calls a function/procedure Calls a method of an object
Language independent Java-specific
No object support Full object support
More complex for programmer Easier in Java
Older technology Advanced, object-oriented
In short
• RPC = function calling over network
• RMI = object method calling over network (Java only)
Extra:
You asked what “RPC does not care about objects” means.
What is an Object (simple)
In programming (like Java), an object is like a thing that has data + functions.
Example:
A Car object
• Data: color, speed, model
• Functions: start(), stop(), accelerate()
58
What “RPC does not care about objects” means
RPC only works with simple functions
RPC just says:
“Run this function and give me the result.”
It does NOT understand objects like Car, Student, BankAccount.
Example (Easy)
RPC style:
addNumbers(a, b)
You just call a function.
RMI style:
[Link](a, b);
Here calculator is an object and add() is its method.
Explanation Like a 15-Year-Old
• RPC is like telling someone:
“Do this task for me.”
• RMI is like telling someone:
“Use your machine (object) and press this button (method).”
In Simple Words
• RPC = only functions, no objects
• RMI = works with objects (Java OOP style)
Q.32) Explain synchronization in DFS with its challenges.
Ans.) Synchronization in Distributed File System (DFS)
• A Distributed File System (DFS) stores files on multiple computers (nodes) connected
through a network.
59
• Synchronization in DFS means making sure all users see the correct and same
version of a file, even when many users access or modify it at the same time.
• It controls who can read or write a file and when, so that data does not get mixed up or
lost.
Simple Example
• Imagine a Google Doc opened by many students.
• If two students edit the same line at the same time, the system must decide:
o who edits first
o how changes are saved
• This control is called synchronization.
Why Synchronization is Needed in DFS
• Many users may read and write the same file at the same time
• Files are stored on different machines
• Without synchronization:
o data may become inconsistent
o files may get corrupted
Challenges of Synchronization in DFS
1. Concurrency Problem
• Many users try to access the same file at the same time.
• Difficult to manage simultaneous read and write operations.
2. Network Delay
• Data travels through a network.
• Slow or unstable networks cause delays, making synchronization difficult.
3. Data Consistency
• Keeping all copies of a file identical on different machines is hard.
• One system may update earlier than others.
60
4. Failure Handling
• A system may crash or disconnect while updating a file.
• This can leave files in an incomplete or wrong state.
5. Scalability
• As the number of users and computers increases, synchronization becomes more
complex and slower.
Conclusion (one-line for exam)
• Synchronization in DFS ensures correct, consistent, and safe access to shared files, but it
faces challenges like concurrency, network delays, data consistency, failures, and
scalability.
Q.33) Justify how load balancing is useful in distributed systems.
Ans.) Justification: How load balancing is useful in distributed systems
A distributed system consists of many computers connected together to perform tasks. In such
systems, many users may request services at the same time. If all the work is given to only one
computer, that computer becomes overloaded, slow, and may even fail. Load balancing solves
this problem by distributing the workload evenly among all available computers.
Load balancing ensures that no single system is overburdened while others remain idle. By
sharing tasks among multiple systems, the overall performance of the distributed system
improves. Each computer handles a reasonable amount of work, which helps tasks to be
completed faster.
Another important benefit of load balancing is better utilization of resources. All computers,
memory, and processing power are used efficiently. This avoids wastage of resources and
improves system efficiency.
Load balancing also increases reliability and fault tolerance. If one computer fails or becomes
slow, the load balancer automatically transfers work to other computers. This ensures that the
system continues to work without interruption.
It also supports scalability. When the number of users increases, new computers can be added to
the system and the load can be balanced among them easily. This allows the system to grow
without affecting performance.
Example:
61
Websites like Google, Amazon, and Netflix use load balancing to handle millions of users at the
same time by distributing requests across many servers.
Conclusion:
Thus, load balancing is very useful in distributed systems as it improves performance,
efficiency, reliability, and scalability, making the system stable and fast.
Q.34) Explain group communication(Q.17)
Q.35) Discuss Google File System (GFS) as a scalable distributed file system.
Ans.) Google File System (GFS)
Google File System (GFS) is a scalable distributed file system designed by Google to store
and manage very large amounts of data across thousands of computers. It is mainly used for
data-intensive applications like Google Search, YouTube, and Google Maps.
Why GFS was needed
• Google deals with huge files (GBs to TBs).
• Normal file systems cannot handle so many machines and failures.
• GFS is designed to work even when some computers fail.
Basic Idea (Simple View)
Imagine:
• One boss computer → decides everything (Master)
• Many worker computers → store actual data (Chunk Servers)
Google File System (GFS) – Computer Example
Imagine a college computer lab
There are 100 computers connected by network.
Step 1: Big file problem
You have a very big video file (like a YouTube video).
One computer cannot store it alone.
62
So Google does this
Step 2: Breaking the file
• The big file is cut into big pieces
• Each piece = chunk (64 MB)
Like:
• Video Part 1
• Video Part 2
• Video Part 3
Step 3: Who stores what?
Master Computer (Head PC)
• Does NOT store the video
• Only keeps a record
o “Part 1 → Computer 5”
o “Part 2 → Computer 20”
o “Part 3 → Computer 41”
Master is like a directory list
Chunk Server Computers (Normal PCs)
• These PCs store the actual file parts
• Each part is stored on 3 different computers
Example:
• Part 1 → PC 5, PC 12, PC 30
Step 4: When someone watches the video
63
1. User’s computer asks Master PC
“Where is the video?”
2. Master replies
“Get parts from PC 5, PC 12, PC 30”
3. User’s computer directly reads data from those PCs
Master is free → system is fast
Step 5: What if one PC crashes?
• PC 5 crashes
• Same part is still on PC 12 and PC 30
• Master notices the crash
• Master makes a new copy on another PC
Video never stops
Why GFS is GOOD (very simple)
• Stores huge data
• Works even if computers fail
• Easy to add more computers
• Fast access to data
One-line exam memory trick
GFS stores big files by splitting them and saving pieces on many computers with backup copies.
Q.36) Discuss code migration in distributed systems(Q.20)
Q.37) Enlist the issues in designing the Distributed System(Q.1) Explain failure
transparency and location transparency in detail.
Ans.) Failure Transparency
Failure transparency means the system hides failures from users.
64
• If one computer (node) crashes, users should not notice it.
• The system continues working by using another computer.
• Users do not need to restart their work or worry about errors.
Example:
If a server in Google Drive fails, you can still open your files because another server takes over
automatically.
Importance:
• Improves reliability
• Increases user trust
• Reduces system downtime
Location Transparency
Location transparency means users do not need to know where a resource is physically located.
• Files, data, or services can be on any computer in the network.
• Users access resources using a name, not a location.
• The system finds the resource automatically.
Example:
When you type [Link], you don’t know where Google’s server is located. The system
handles it for you.
Importance:
• Easy to use
• Flexible system design
• Resources can be moved without affecting users
Q.38) Explain the various ordered semantics used for Many-to-Many communication.
Ans.) Ordered Semantics in Many-to-Many Communication
In many-to-many communication, many computers (senders) send messages to many computers
(receivers) at the same time.
Ordered semantics means rules about the order in which messages must be received.
65
1. Unordered Semantics
• Messages can arrive in any order.
• No guarantee about which message comes first.
• Fast but confusing if order matters.
Example:
Many students send WhatsApp messages in a group; messages appear randomly.
2. FIFO (First-In-First-Out) Ordering
• Messages from one sender are received in the same order they were sent.
• Order is guaranteed per sender, not between different senders.
Example:
If Student A sends Msg1 then Msg2, everyone receives Msg1 before Msg2 from A.
3. Causal Ordering
• If one message causes another message, receivers must see them in that order.
• Logical relationship is preserved.
Example:
Teacher sends “Exam postponed” → then “New date is Friday”.
Everyone must see the postponement message before the new date.
4. Total Ordering
• All messages are received by all receivers in exactly the same order.
• Strongest and strictest ordering.
Example:
In an online auction, everyone sees bids in the same order, so no confusion.
5. Partial Ordering
• Only related messages follow an order.
• Unrelated messages can arrive in any order.
66
Example:
Replies to a question stay in order, but other chats can appear anywhere.
Summary Table (for quick revision)
Ordering Type Message Order Guarantee
Unordered No order guaranteed
FIFO Order per sender
Causal Cause-effect order
Total Same order for everyone
Partial Order only for related messages
Q.39) Explain the desirable features of a good Distributed File System (DFS)(Q.14)
Q.40) Explain load estimation, process transfer, and location policies with respect to the
load balancing approach in distributed systems(Q.10)
Q.41) Discuss the techniques to achieve process resilience.
Ans.) Process Resilience (Simple Meaning)
Process resilience means keeping a program or process running correctly even if some part
of the system fails (like a computer crash, network problem, or power failure).
Think of it like:
If one player in a team falls, the game should still continue.
Techniques to Achieve Process Resilience
1. Replication
• The same process is copied and run on multiple machines.
• If one copy fails, another copy continues the work.
• Example: Multiple servers running the same website.
2. Checkpointing
67
• The process saves its current state at regular intervals.
• If it crashes, it restarts from the last saved point, not from the beginning.
• Example: Saving a game so you don’t start from level 1 again.
3. Process Migration
• A running process is moved from one computer to another.
• Done when a system is overloaded or about to fail.
• Example: Shifting work to another computer before shutdown.
4. Failure Detection
• The system continuously checks whether processes are alive or not.
• If a process stops responding, the system detects the failure quickly.
• Example: “Last seen online” check.
5. Automatic Restart
• When a process crashes, it is automatically restarted.
• Often combined with checkpointing.
• Example: Apps reopening after a crash.
6. Leader Election
• In a group of processes, one process acts as a leader.
• If the leader fails, another process is selected as the new leader.
• Example: Choosing a new class monitor if the old one is absent.
7. Logging
• All important actions are recorded in logs.
• After failure, logs help the system recover the correct state.
68
• Example: Transaction history in a bank system.
Conclusion (One-line for exams)
Process resilience ensures that distributed systems continue to work correctly even when failures
occur, using techniques like replication, checkpointing, and automatic recovery.