0% found this document useful (0 votes)
62 views3 pages

Assign 5

This document outlines a lab assignment to implement the Bully election algorithm. The objectives are to understand election algorithms and simulate the Bully algorithm. The document defines elections in distributed systems as selecting a leader node to coordinate activities. It describes the Bully algorithm, where nodes broadcast leadership claims and higher priority nodes override lower priority nodes. The student will write a Python program that takes process IDs as input and outputs the selected coordinator, concluding they successfully implemented the Bully algorithm.

Uploaded by

Professor Exe
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)
62 views3 pages

Assign 5

This document outlines a lab assignment to implement the Bully election algorithm. The objectives are to understand election algorithms and simulate the Bully algorithm. The document defines elections in distributed systems as selecting a leader node to coordinate activities. It describes the Bully algorithm, where nodes broadcast leadership claims and higher priority nodes override lower priority nodes. The student will write a Python program that takes process IDs as input and outputs the selected coordinator, concluding they successfully implemented the Bully algorithm.

Uploaded by

Professor Exe
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
You are on page 1/ 3

DISTRIBUTED COMPUTING - LAB ASSIGNMENT 1

NAME: PRATYUSH JHA Panel: E (E1)


PRN:1032191000 Roll No.: PE31

TITLE:
Write a Program to Implement Bully Election Algorithm.

AIM:
To study and implement Bully Election Algorithm

OBJECTIVES:
1. To understand the working of election algorithms
2. To simulate bully algorithm

THEORY:

Elections:
In distributed systems, an election is the process of selecting a leader node among a group
of nodes. This leader node is responsible for coordinating the activities of the other nodes
and making decisions on behalf of the group. Elections are typically used to establish a
point of control and coordination in the system, and to ensure that there is always a
designated leader available to handle tasks such as coordinating communication,
managing resources, and making decisions.
There are several different algorithms that can be used to conduct elections in distributed
systems, each with its own strengths and weaknesses. Some of the most common
algorithms include the bully algorithm, the ring-based algorithm, the hierarchical
algorithm and the consensus-based algorithm (e.g. Paxos, Raft). The choice of algorithm
will depend on the specific requirements of the system, such as the number of nodes, the
network infrastructure, and the level of fault tolerance required.

Bully Algorithm:
The bully algorithm is a method used in distributed systems to elect a leader or
"coordinator" among a group of nodes. The algorithm works by having each node
broadcast a message to all other nodes claiming to be the leader. Nodes with a higher
priority will override the claims of nodes with a lower priority. In the event that the
current leader becomes unavailable, the nodes will continue to send out these messages
until a new leader is elected. This algorithm is named "bully" because the nodes with a
higher priority "bully" the nodes with a lower priority into submission. The bully
algorithm is simple but can have high network overhead and may not be suitable for
large-scale distributed systems.
Types of messages -
There are basically 3 types of messages:
1. An election message to initiate the election
2. A reply/response message given in response to the election message
3. A coordinator message sent to inform other processes, the id of the coordinator
process.

INPUT:
Process IDS

OUTPUT:
Selected Coordinator Process

PLATFORM:
Windows

PROGRAMMING LANGUAGE:
Python

CONCLUSION:
Thus, bully algorithm is successfully implemented.

FAQs

1. What is the time complexity (best, avg, worst) of bully algorithm?


The time complexity of the bully algorithm depends on the number of processes in the
system and the rate at which failures occur.
In the best-case scenario, where there are no failures and all processes are functioning
properly, the algorithm has a time complexity of O (1) as it only takes a constant amount
of time for the highest-priority process to be elected as the coordinator.

In the average case, the algorithm has a time complexity of O(n) where n is the number of
processes, as each process must send and receive messages from other processes before
determining who the coordinator is.
In the worst-case scenario, where there are many failures and a lot of processes are
constantly competing for the role of coordinator, the algorithm has a time complexity of
O(n^2) as each process must send and receive messages from other processes multiple
times before determining who the coordinator is.
It's important to note that the time complexity is based on theoretical analysis and the
actual time complexity can vary depending on the actual implementation and
the environment.

2. Why do we have to elect the coordinator process?


In a distributed computing system, the coordinator process is responsible for coordinating
and managing communication between different nodes or processes. Electing a
coordinator process ensures that there is a clear leader in charge of coordinating and
managing the system, which helps to prevent conflicts and improve the overall efficiency
and stability of the system. Additionally, electing a coordinator process allows for the
possibility of failure or replacement of the coordinator, ensuring the
continuity of the system.

3. How did the name of “Bully” approach come up?


In the field of distributed systems, Bully Algorithm is a method of selecting a leader node
among a group of nodes in a computer network. It uses an election process in which
nodes send messages to determine which node has the highest priority and is therefore
elected as the leader. The algorithm is called "bully" because the node with the highest
priority will "bully" or force the other nodes to recognize it as the leader. The Bully
Algorithm is mainly used for election of coordinator in the distributed systems.

You might also like