Lab Manual - LP V - LA 6
Lab Manual - LP V - LA 6
LAB MANUAL
Distributed System
Lab Practice - V
Class:-BE Course:-2019
P.E.S’s Modern College of Engineering, Pune-05.
Department of Information Technology
Lab Manual
Subject Code & Name: 414454 LP - V (2019 Pat)
Class: BE
Semester: II
Compiled by:
Mrs. Sampada A. Kulkarni
Ms. Shoma S. Mitkari
VISION AND MISSION OF THE INSTITUTE
Vision Statement:
To create a collaborative academic environment to foster professional excellence and
ethical values
Mission Statement:
1. To develop outstanding professionals with high ethical standards capable of creating and
managing global enterprises
2. To foster innovation and research by providing a stimulating learning environment
3. To ensure equitable development of students of all ability levels and backgrounds
4. To be responsive to changes in technology, socio-economic and environmental conditions
5. To foster and maintain mutually beneficial partnerships with alumni and industry
Vision Statement:
To develop proficient IT engineers for the benefit of Industry and Society.
Mission Statement:
1. To achieve academic excellence.
● The course aims to provide an understanding of the principles on which the distributed
systems are based, their architecture, algorithms and how they meet the demands of
Distributed applications.
● The course covers the building blocks for a study related to the design and the
implementation of distributed systems and applications.
Course Outcomes
Sr. Page
Title
No. No.
Implement multi-threaded client/server Process communication
1.
using RMI.
Develop any distributed application using CORBA to
2. demonstrate object brokering.
(Calculator or String operations).
Develop a distributed system, to find sum of N elements in an
array by distributing N/n elements to n number of processors
3.
MPI or OpenMP. Demonstrate by displaying the intermediate
sums calculated at different processors.
4. Implement Berkeley algorithm for clock synchronization.
5. Implement token ring based mutual exclusion algorithm.
6. Implement Bully and Ring algorithm for leader election.
Create a simple web service and write any distributed
7.
application to consume the web service.
Mini Project (In group): A Distributed Application for
8.
Interactive Multiplayer Games
Assignment No: 6
Title / Objective: Bully and Ring Algorithm
Problem Statement: Implement Bully and Ring algorithm for leader election.
Course Outcome:
A. For Prerequisites –
B. For Assignment -
Theory:
Election Algorithm:
1. Many distributed algorithms require a process to act as a coordinator.
2. The coordinator can be any process that organizes actions of other processes.
3. A coordinator may fail.
4. How is a new coordinator chosen or elected?
Assumptions:
Each process has a unique number to distinguish them. Processes know each other's process
Number.
There are two types of Distributed Algorithms:
1. Bully Algorithm
2. Ring Algorithm
Bully Algorithm:
A. When a process, P, notices that the coordinator is no longer responding to requests, it
initiates an election.
1. P sends an ELECTION message to all processes with higher numbers.
2. If no one responds, P wins the election and becomes a coordinator.
3. If one of the higher-ups answers, it takes over. P’s job is done.
B. When a process gets an ELECTION message from one of its lower-numbered
colleagues:
1. Receiver sends an OK message back to the sender to indicate that he is alive and will take
over.
2. Eventually, all processes give up a part of one, and that one is the new coordinator.
3. The new coordinator announces its victory by sending all processes a CO-ORDINATOR
message telling them that it is the new coordinator.
C. If a process that was previously down comes back:
1. It holds an election.
2. If it happens to be the highest process currently running, it will win the election and take over
the coordinators job.
“Biggest guy" always wins and hence the name bully algorithm
Ring Algorithm:
Initiation:
1. When a process notices that coordinator is not functioning:
2. Another process (initiator) initiates the election by sending "ELECTION" message (containing
its own process number)
Leader Election:
3. Initiator sends the message to its successor (if successor is down, sender skips over it and goes
to the next member along the ring, or the one after that, until a running process is located).
4. At each step, sender adds its own process number to the list in the message.
5. When the message gets back to the process that started it all: Message comes back to initiator.
In the queue the process with maximum ID Number wins.
Initiator announces the winner by sending another message around the ring.
Ring.java
Bully.java
Inference:
Election algorithms are designed to choose a coordinator. We have two election algorithms for
two different configurations of distributed system. The Bully algorithm applies to system where
every process can send a message to every other process in the system and The Ring algorithm
applies to systems organized as a ring (logically or physically). In this algorithm we assume that
the link between the processes are unidirectional and every process can message to the process
on its right only
Oral questions: