Parallel and Distributed Algorithms Notes
Parallel and Distributed Algorithms Notes
Introduction
Parallel and distributed systems use specialized algorithms to enhance computational efficiency by enabling
multiple processors to work simultaneously. These algorithms leverage concurrency to divide large problems
into smaller subproblems that can be processed independently.
1. Partitioning and Mapping Techniques: Properly distributing tasks among processors to maximize
efficiency.
o Examples:
Parallel Merge Sort: Divides an array into smaller subarrays, sorts them in parallel, and
merges the results.
Parallel Matrix Multiplication: Splits matrices into submatrices and performs
multiplications concurrently.
o Example:
Jacobi Method: Iteratively solves linear equations in parallel by updating solutions based
on previous iterations.
3. Search Algorithms: Execute graph traversal in parallel. Efficient searching is vital for large-scale systems,
especially when handling extensive datasets.
Parallel Binary Search: Distributes the array across processors, allowing each to perform a binary
search on its assigned portion. Results are then combined.
Hash-Based Searching: Uses a hash function to distribute data across processors, enabling quick
lookups and retrievals.
Parallel BFS (Breadth-First Search): Processes all nodes at a particular level in parallel, improving
graph traversal efficiency.
o Examples:
o Examples:
Parallel Minimum Spanning Tree (MST): Finds the MST efficiently in parallel.
Parallel Shortest Path Algorithms: Compute shortest paths (e.g., Dijkstra’s or Floyd-
Warshall’s algorithm) in parallel.
6. Load Balancing Algorithms: Distribute computational tasks efficiently across processors to avoid
bottlenecks.
o Example:
Work Stealing Algorithm: Idle processors take work from busy ones to balance the load.
Raft: An alternative to Paxos, used for leader election and log replication.
Synchronization Issues: Ensuring tasks execute in the correct order without unnecessary delays.
Fault Tolerance: Handling failures in distributed environments without losing data or progress.
Load Imbalance: Distributing work unevenly may lead to inefficiencies and delays.
Big Data Processing: Large-scale data analytics using distributed computing frameworks.
Artificial Intelligence: Training deep learning models efficiently with parallel processing.
Real-Time Systems: Ensuring low-latency processing for critical applications like autonomous vehicles
and financial transactions.
Definition
Leader election is the process by which a distributed system selects a single node to act as the leader,
responsible for coordination, decision-making, and resource allocation.
1. Bully Algorithm
o A node detecting a leader failure initiates an election by messaging nodes with higher IDs.
2. Ring Algorithm
o Nodes form a logical ring and know only their immediate successor.
o When a node detects leader failure, it circulates an election message containing its ID.
o The message travels around the ring, and the node with the highest ID is elected.
2. Mutual Exclusion
Definition
Mutual exclusion ensures that only one process accesses a critical section at a time, preventing race conditions
and maintaining data consistency.
How It Works:
Each process maintains a logical clock and sends a request with its timestamp to all processes.
The process enters the critical section when all replies are received.
2. Ricart-Agrawala Algorithm
How It Works:
A process requests permission from all other nodes before entering the critical section.
Other nodes reply immediately if they are not in the critical section.
After completing execution, the process releases the lock by informing all waiting processes.
3. Token-Based Algorithm
How It Works:
After using the resource, the process passes the token to the next requester.
1. Merge Sort – Splits an array, sorts halves recursively, and merges them.
3. Matrix Multiplication (Strassen’s Algorithm) – Breaks matrices into smaller blocks for faster
multiplication.
2. Load Balancing
Definition: Load balancing distributes tasks efficiently across multiple computing resources to prevent
bottlenecks and maximize system performance.
2. Dynamic Load Balancing – Tasks are allocated in real time based on current system load.
2. Least Loaded – Assigns tasks to the node with the lowest workload.
4. Ant Colony Optimization – Uses an adaptive approach inspired by ants finding optimal paths.
3. Task Scheduling
Definition: Task scheduling ensures efficient allocation of tasks to processors in parallel and distributed
systems, optimizing execution time and resource usage.
Types of Scheduling
Type Description Example
Static Scheduling Task allocation is precomputed before execution. Grid computing task allocation.
Dynamic Scheduling Task assignment happens during execution. Load balancing in cloud systems.
3. Priority Scheduling
4. Fair Scheduling
Purpose Distributes workload across multiple nodes. Assigns tasks to processors efficiently.
Focus Prevents overloading and ensures fairness. Minimizes execution time and maximizes
Feature Load Balancing Task Scheduling
throughput.