Mod4 - DC MU
Mod4 - DC MU
1) Compare and contrast load balancing and load sharing using examples.
Action:
o Server A sends 2.5 tasks to D and 2.5 to B (if fractional tasks are supported or
approximated).
Focus: Equal load → High overhead to track all loads and balance.
Action:
A process is a running instance of a program. When we start a program, it doesn't execute instantly.
It follows several steps, and this step-by-step execution is called a process.
Each process has its own memory space and does not share it with other processes.
1. The program is first converted into binary code and loaded into the computer’s memory.
Features of a Process
Each process has its own memory space (called an address space).
Processes don’t need to be synchronized with each other all the time.
What is a Thread?
o Code segment
o Data segment
o Files
o Registers
o Stack
o Counter
How Does a Thread Work?
Although only one thread runs at a time, the OS quickly switches between threads (called
context switching) to make it feel like they run in parallel.
Types of Threads
1. User-Level Threads
2. Kernel-Level Threads
Purpose:
To measure the workload of each node to determine which nodes are overloaded or
underloaded.
How it works:
Types:
Memoryless Method: Assumes all processes have the same remaining service time.
o Distribution Method: Predicts future behaviuor using known service time patterns.
o CPU Utilization: Tracks actual CPU usage over time—the standard in modern
systems.
In Load Sharing:
Purpose:
Determines when and under what conditions a node should transfer processes.
How it works:
Based on a threshold system:
Types:
Single-Threshold Policy: Uses one threshold to trigger process transfers, though this can be
unstable.
To reduce instability double-threshold policy has been proposed which is also known as high-
low policy
Purpose:
Manages how nodes share their load information with each other.
How it works:
Types:
4. Location Policy
Purpose:
Sender-Initiated:
o Overloaded nodes seek underloaded partners.
o Optimal for light to moderate loads.
Receiver-Initiated:
o Underloaded nodes seek overloaded partners.
o Best during high system load.
Shortest:
o Selects the node with the least load from a sample.
Bidding Method:
Pairing:
o Nodes form exclusive load-sharing pairs. ✅ Reduces overall system
communication.
Purpose:
Types:
Selfish:
o Prioritizes local processes.
o Delays remote process execution.
Altruistic:
o Prioritizes remote processes.
o Improves system-wide performance despite local delays.
Intermediate:
o Prioritizes local processes when they dominate.
o Favours remote processes when local load is light.
Purpose:
Types:
Uncontrolled:
o Allows unlimited process migrations.
o Risks system instability.
Controlled:
o Uses a counter to limit migrations.
o Stops migrations when limit is reached.
Irrevocable:
o Permits only one migration per process.
o Simple but rigid.
🔷 Introduction
In distributed systems, resources like CPU, memory, and storage are spread across multiple
nodes. Load balancing ensures these resources are used efficiently by preventing any single
node from being overburdened while others remain idle.
Example: In a file storage system, file requests are distributed to storage servers to avoid
overloading any one of them.
By distributing tasks evenly, load balancing reduces processing delays and increases the
throughput of the system. It ensures faster response times for users.
Example: In a web application, user requests are balanced across web servers to ensure faster
page loads.
If one node fails or goes offline, the load balancer redirects traffic to the remaining active
nodes. This prevents system downtime and ensures continuous service.
Example: In an e-commerce site, even if one server fails during peak hours, load balancer
routes traffic to backup servers.
🔷 4. Supports Scalability
As demand grows, new nodes can be added to the system. A load balancer automatically
starts distributing load to new nodes, enabling horizontal scaling without interrupting the
service.
Example: During a festival sale, more servers are added to handle increased traffic.
Without load balancing, too many requests to a single node can cause bottlenecks, slowing
down the entire system. Load balancing prevents this by spreading the load evenly.
🔷 6. Cost-Efficiency
Balanced resource usage means fewer idle machines and better ROI. It reduces the need for
over-provisioning and saves operational costs.
+-------------+
| | → Server B
| | → Server C
+-------------+
Extra Questions
Code migration involves transferring software code from one environment to another,
which is crucial in distributed systems where different parts of an application run on
separate computers or servers. This process helps in managing and updating the system
efficiently.
E.g searching for information on the internet. A search query can be easily implemented in
the form of a small mobile program called a mobile agent which moves from site to site. We
may be able to achieve a linear speedup over using a single program instance by making
several copies of such program & sending each to a different site.
Reduce Network Bandwidth: Migrate part of client application to database server to perform
many database operations, Send only result across network, Migrate part of server application
to client, Migrate part of database server to client to process forms on client side, Reduces
database operations over the network
Code migration refers to moving code (and possibly its execution state) from one system
(host) to another in a distributed environment. There are several techniques used to perform
this migration effectively, depending on the purpose and complexity.
Example: Transferring a script file or executable to another server for scheduled execution.
Definition: Both the code and its execution state (variables, call stack, etc.) are
transferred.
The program continues from the exact point it left off after migration.
This technique is more complex but allows seamless transfer of long-running
processes.
Example: Pausing a game on one device and resuming on another without restarting.
Definition: Only the code and static data are transferred, but not the execution state.
The code starts execution from the beginning on the new host.
It's a compromise between static and strong migration.
Example: Downloading a module from a central server and executing it on a local machine.
Definition: Uses software agents that can move themselves (with their code and data)
to another system.
Agents can communicate, make decisions, and migrate autonomously.
Often used in AI-based and intelligent systems.
Example: An agent that moves between servers to collect logs or monitor activities.
Code migration means moving code (programs or parts of them) from one machine to another
in a distributed system. While it’s useful, it also brings several challenges. Below are the
main challenges explained in simple terms:
👉 Problem:
Data may be stored on different computers. When you migrate code, you must make sure all
systems have the same, correct data.
✅ Solutions:
Copy data properly: Use smart ways to copy and update data (like master-slave or
multi-master replication).
Use agreement protocols: Use methods like Paxos or Raft so all systems agree on
data updates.
Use transactions: Treat data updates like a package — either everything happens or
nothing happens, to avoid broken states.
👉 Problem:
When migrating code or data over a network, delays (latency) can slow things down or cause
problems.
✅ Solutions:
Improve the network: Use faster connections and better settings to reduce delays.
Send only what’s needed: Break large data into parts and send only what's necessary.
Don’t wait unnecessarily: Use asynchronous operations so the system doesn't
freeze while waiting.
3. Security
👉 Problem:
Distributed systems are more open to attacks, so keeping everything safe during migration
is important.
✅ Solutions:
Encrypt data: Use secure connections (like SSL/TLS) so data can't be stolen in
transit.
Limit access: Make sure only the right people or systems can access the data and
code.
Check regularly: Perform security checks often to find and fix problems.
4. Versioning and Rollbacks
👉 Problem:
During migration, multiple versions of code or data might be used. If something goes wrong,
you should be able to go back to the previous version.
✅ Solutions:
Track changes: Use tools like Git to manage code and data versions.
Rollback plan: Always have a way to undo changes in case something fails.
Test first: Test the migration process carefully before doing it live.
Platform Compatibility: Make sure the new system supports your code and tools.
Compliance: Follow all laws and rules (e.g., data privacy regulations).
Ongoing Maintenance: Plan how you’ll support and maintain the new system.
Development Limits: Be aware of language, hardware, or system restrictions.
Technical Problems: Expect some bugs or errors — be ready to fix them.
Cost and Risk: Always estimate the cost and possible risks before migrating.