Code Monkey home page Code Monkey logo

gossip-simulator's Introduction

Gossip Simulator

A simple java implementation of the Gossip protocol. Messages between nodes are sent using protobuf. Nodes are multithreaded, and are capable of handling requests parallely.

MyServer

The MyServer script is used to actually initialize a server. The usage is: ./MyServer <nodes_in_network> [ -i <input_file> ]

IT IS RECOMMENDED TO NOT RUN THIS SCRIPT MANUALLY

Wrapper

The Wrapper script initializes and runs all the servers based on what we give it. The usage is: ./Wrapper -p <number_of_type_1_processes> -n <number_of_type_2_processes> -i <input_file>

Process types

  • Type 1 process is one that takes an input file and uses that to send messages (each line is considered a message), at regular intervals.
  • Type 2 process is the process that has no input and just acts as a relay in the network.

Note: All Type 1 processes also have the functionality of Type 2 processes.

Configuring the nodes

Each node has 2 default wait times defined:

  • GOSSIP-READ-INPUT-TIME: The time that the process is supposed to wait between reading two lines of input.
  • GOSSIP-PROCESS-TIME: The time taken to process a gossip. This is the delay done after calling the process gossip funtion.

CLOCK

The clock used in this simulation is very simple. The idea for the clock was to satisfy the following. If a process gets messages out of order, they should be discarded, two messages m1 and m2 are out of order if and only the below is true:

  • m1 and m2 are generated by the same process, and
  • m1 is read before m2 in the file, but the process has received m2 before m1
  • This means the if m1 and m2 are generated by different process, they can never be out of order.

So the clock used is a combination of ProcessID:ProcessClock Look at the acceptMessage function to see how our clock comparision is done.

Other parts of the code are expected to be documented in the code is documentation format, or inline documentation.

gossip-simulator's People

Contributors

amoghbl1 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

gossip-simulator's Issues

Make file problem

Looks like

make clean

doesn't delete all the input files.
Figure out why.

Config file for MyServer

When a server is created, command line arguments are passed.
Maybe this can be changed to be something that reads a config file for more extensibility.

Refactor

The inter class relations might not be very good, restructure them to be more extensible.

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.