Code Monkey home page Code Monkey logo

lamports-mutual-exclusion-algorithm's Introduction

Lamport's Mutual Exclusion Algorithm

Files in the repo:

  1. client1.c - Client code
  2. Server.c - Server code
  3. repository1, repository2, repository3 - the file repositories for 3 different servers.
  4. cfg.txt - file used for client connectivity

The Server.c file should be run first.

Command line arguments to run 'Server': ./a.out <SERVER-PORT-NUMBER> <REPOSITORY-NAME>

REPOSITORY NAME can be: repository1 repository2 repository3

Command line arguments to run 'client1':

./a.out <UNIQUE NAME> <IP ADDRESS OF SERVER 1> <PORT NUMBER OF SERVER 1> <IP ADDRESS OF SERVER 2> <PORT NUMBER OF SERVER 2> <IP ADDRESS OF SERVER 3> <PORT NUMBER OF SERVER 3>

Note:

Once the code starts running, it will ask for a Port number to start a TCP server in the client1.c program.

In the end, when the execution stops, press ENTER in one of the client windows to close sockets and end all programs.

If you are using a different repository, please use a repository with 9 txt files as I have hard-coded the value for certain iterations and was not able to change that in time.

I have given 20 random READ/WRITE for random files through random servers using the rand() function.

All the repository files and the cfg.txt files will be cleared or data each time the servers start.

Reference: http://en.wikipedia.org/wiki/Lamport%27s_Distributed_Mutual_Exclusion_Algorithm

lamports-mutual-exclusion-algorithm's People

Contributors

nahzor 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.