Code Monkey home page Code Monkey logo

lamport_rabbitmq's Introduction

Lamport's Algorithm Implementation

That's a distributed implementation of Lamport's Algorithm for Mutual Exclusion, written in python 3 using pika rabbitMQ library.

Even if the nodes are launched in the same machine, they receive different ports.

The system simulates a situation where multiple processes (from different machines or not) try to access a shared resource, that may only be used by one node at a time.

Full documentation at: Repport

Requirements

Requirement Function
Python 3 This implementation was tested in Python 3.6.2 so any Python 3 compiler may be able to run the code.
Pika 0.11.0 RabbitMQ python library
RabbitMQ 3.6.12 You must run a RabbitMQ Server on localhost

Usage

There are some usage examples on the Repport, but, to start:

1- Install RabbitMQ and run a server on localhost.

2- Install dependecies

pip3 install -r requirements.txt

3- Launch a node:

python node.py

4- Broadcast request message:

After the node is connected, type a integer x to create a request of x seconds.

Limitations

This implementation has the following limitations, that may be respected to avoid deadlock situations.

1- At least two clients must be running before the first request is sent.

2- A node can only join the system if the queues of all the others nodes are empty.

3- No node shall leave the system.

Silent Mode

To hide debug logs so the terminal only shows the critical section being used, open node.py and change the global constant DEBUG to False.

lamport_rabbitmq's People

Contributors

valentecaio avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.