Giter Site home page Giter Site logo

dist_hw_2's Introduction

Distributed Systems HW 2

<UT Austin, Fall 2017> <Audrey Addison, Eric Addison>

Description

The programming portion of this HW was to implement a fault-tolerant distributed ticket-booking system. The list of "seat assignments" in this system acts as a shared resource, so read or write modifications to the list require access to a critical section of code. Access to the critical section is managed by Lamport's mutex algorithm.

Directory Structure

The source code does not use packages for modularity. The directory structure is:

  • inputs: input config files for client and server
  • lib: library directory containing Jackson JSON library for Java
  • src: all source code for this HW

Key Code

Most of the code handles processing messages or TCP connections. Here are some key notes about the code:

  • The core of the Lamport Mutex algorithm is implemented in a set of methods near the top of the LamportMutex class.
  • Fault tolerance is achieved by:
    • Having the client attempt to reconnect to a different server if the connection is lost
    • Updating the number of live servers in the Mutex algorithm
    • Allowing servers to reconnect after going down

We did not address the issue of unresponsive servers ... only dead connections.

How to build

This code has one library dependency, which is a Java library for JSON serialization. This library must be included in the classpath. A script is included to compile the java code into a JAR file in build.sh, which runs the following commands:

mkdir build
javac -classpath ./lib/jackson-annotations-2.9.1.jar:./lib/jackson-databind-2.9.1.jar:./lib/jackson-core-2.9.1.jar:. -d ./build/ src/*.java

cd build
jar cvf ../HW2.jar *

cd ..
rm -rf build

How to run

Scripts are provided to run the Server or Client class from the compiled JAR file. They are called by:

./run_client.sh inputs/client1.txt          # run Client.main() with the given config file

./run_server.sh inputs/server1.txt          # run Server.main() with the give config file

./run_server.sh inputs/server2.txt restart  # restart a failed server (server 2)

The Servers would like to be started in order, however this is not necessary. All servers must start initially before a client can reliably connect. After the initial startup, servers can fail and come back up (using the restart option when launching), as long as one server is still running.

dist_hw_2's People

Contributors

ericaddison avatar

Stargazers

nk_ysg avatar

Watchers

 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.