Coder Social home page Coder Social logo

leader-election's Introduction

Leader-Election

Ring based leader election simulaor (LCR and HS algorithms) This is a leader election simulator based on LCR and HS algorithms. author: Wenjun Zeng

How to run: Please run the leaderElection.java file to start the simulator. The system would ask the user to enter the size of the ring and only an integer from 1 to 1100 is acceptable. Then, the system would ask to choose the type of the ring. Once again, only the correct number of the option is acceptable. At the end of the program, each processor with its ID, the round number and message number of both algorithms would be displayed on the screen.


five classes are constructed in this simulator. The main functionalities of the five classes are described as follows:

The “Processor” class is constructed to serve as a processor in rings;

The “HSalgorithm” and “LCR_algorithms” realize the functionalities of terminating HS and LCR algorithms, respectively.

The “messageCounter” class is responsible for counting the numbers of rounds and messages in every execution.

The “leaderElection” class containing the main function can provide a user interface to implement the two algorithms and output the information about time and communication complexities. An ArrayList storing several “Processor” objects is initialized as a ring. There are three types of rings to choose: ascending clockwise rings, descending clockwise rings and random rings.

leader-election's People

Contributors

zwj321123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mnis99

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.