Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

CD Practical Project - P2P Drive-Through | UA 2018/2019

License

Notifications You must be signed in to change notification settings

vascoalramos/drive-through-p2p

Repository files navigation

Drive-Through Restaurant P2P

Description

This project is a product of the first practical assignement of one of our classes: Distributed Computing and the main idea behind it is to implement a drive-through restaurant using a peer-to-peer distributed system architecture.

Simulation Entities

This restaurant simulation is composed by five different entities:

  • Restaurant: entity responsible for managing all kitchen equipment (fryer, barbecue griller and bar).
  • Clerk: receives the clients and records their requests.
  • Chef: receives the requests and cooks them.
  • Waiter: delivers the order to the respective client and receives payment.
  • Client: makes a food request.

This entities are organized in a token-ring.

Kitchen Equipments

The kitchen is composed by 3 equipments:

  • Barbecue griller: where the Chef can prepare one hamburger (average preparing time: 3 seconds)
  • Bar: where the Chef can prepare one drink (average preparing time: 1 second)
  • Fryer: where the Chef can prepare one package of fries (average preparing time: 5 seconds)

Each action takes a random time to be completed. This random time follows a gaussian distribution with an average time of 2 seconds and a standar deviation of 0.5 seconds. One client request is composed by at least one item (hamburger, drink or package of fries), but can be one possible combination of items with a maximum of 5 items. This request is generated randomly.

Prerequisites

  • Clone this repository

How to run

Open two terminals:

simulation:

$ python simulation.py

client:

$ python client.py

How to run (other option)

We created a run script in bash that executes 20 clients, so that is another way to execute and test the program:

$ ./run.sh

Git Upstream

Keep your fork sync with the upstream

$ git remote add upstream git@github.com:mariolpantunes/load-balancer.git
$ git fetch upstream
$ git checkout master
$ git merge upstream/master

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Releases

No releases published

Packages

No packages published