Skip to content

Project developed within the scope of the Distributed Systems course, of the Master's degree in Network and Information Systems Engineering at the Faculty of Sciences of the University of Porto, focused on distributed systems concepts.

Notifications You must be signed in to change notification settings

cmps5/distributed-systems

Repository files navigation

Distributed Systems

Project Assignment (2024/2025)

This project was developed within the scope of the Distributed Systems course, of the Master's degree in Network and Information Systems Engineering at the Faculty of Sciences of the University of Porto, implemented in three separate packages. Each one focuses on distributed systems concepts and implements distinct functionalities.


1. Mutual Exclusion with the Token Ring Algorithm (ds.assign.trg)

TRG

Description

  • Implements a token ring network with N peers.
  • Ensures mutual exclusion for accessing a calculator multi server.
  • Peers communicate in a ring topology and use a token to access the server.
  • Each peer generates requests based on a Poisson distribution (4 events/minute).

How to Compile

Run the following command in the project root:

make trg

How to Execute

  1. Start the server on a designated machine:
    ./trg_server.sh <serverHost> <serverPort>
  2. Start each peer on its respective machine:
    ./trg_peer.sh <host> <port> <nextPeerHost> <nextPeerPort> <ServerHost> <ServerPort>
  3. Inject the token into one of the peers to start the token ring:
    ./trg_injector.sh <peerHost> <peerPort>

Notes

  • If a peer fails, the ring breaks. Restart the failed peer and re-inject the token to resume operation.

2. Count the Number of Nodes in a P2P Network (ds.assign.p2p)

P2P

Description

  • Implements a P2P network with N peers.
  • Each peer maintains a map of connected peers and disseminates the map using the Anti-Entropy Algorithm.
  • Updates occur twice per minute following a Poisson distribution.
  • Handles peer removal using timestamps for entries, removing peers when they exceed timeout.

How to Compile

Run the following command in the project root:

make p2p

How to Execute

Start each peer on its respective machine:

./p2p_peer.sh <host> <port> [<neighborHost> <neighborPort>...]

Notes

  • If a peer fails, its neighbors will keep trying to connection. After a timeout, the failed peer is removed from the network.
  • Restarting a failed peer before the timeout allows it to rejoin the network.

3. A Basic Chat Application Using Totally-Ordered Multicast (ds.assign.tom)

alt text

Description

  • Implements a chat application with N peers.
  • Ensures a totally ordered sequence of messages using Lamport clocks.
  • Messages are sent according to a Poisson distribution (1 event/second).
  • Messages are ordered globally before processing, ensuring consistent output across all peers.

How to Compile

Run the following command in the project root:

make tom

How to Execute

Start each peer on its respective machine:

./tom_peer.sh <host> <port> [<neighborHost> <neighborPort>...]

Notes

  • Peers not printing the same words, but they are printed in the same order for all peers.

General Notes

  • To compile all packages:
    make
  • Grant execution permissions for all shell scrips (.sh files):
    chmod +x *.sh
  • To clean up compiled .class files:
    make clean

Author

Carlos Santos 201607406

About

Project developed within the scope of the Distributed Systems course, of the Master's degree in Network and Information Systems Engineering at the Faculty of Sciences of the University of Porto, focused on distributed systems concepts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published