Skip to content

Sam-Mucyo/dist-clock-sim

Repository files navigation

Overview

This project simulates a small asynchronous distributed system with multiple virtual machines running at different speeds, each maintaining their own logical clock according to Lamport's logical clock rules.

Engineering Notebooks & Results

Design notebook: notebook.md

Other entries:

Results: analysis.ipynb

Rubric Breakdown

  • Multiple processes? virtual_machine.py, simulation_controller.py
  • Follow the specifications? virtual_machine.py, simulation_controller.py
  • Observations leading to conclusions? analysis.ipynb
  • Tried the described variations? analysis.ipynb
  • Bonus? analysis.ipynb

Functionalities

The simulation creates multiple virtual machines that:

  • Run at different clock rates (1-6 ticks per second)
  • Communicate with each other via sockets
  • Maintain message queues for incoming messages
  • Update logical clocks based on internal events and message passing
  • Log all activities to individual log files

Project Structure

  • virtual_machine.py - Implements the VirtualMachine class that models a single machine
  • simulation_controller.py - Controls the initialization and execution of the model by running VMs
  • log_analyzer.py - Analyzes and visualizes the results of the simulation
  • logs/ - Directory where machine logs are stored
  • test_simulation_controller.py - unit tests
  • test_virtual_machine.py - unit tests

How to Run

After cloning the repo, you may need to use the setup script to setup the environment with required dependencies by running:

chmod +x setup
./setup

Rest (running the model and generating results plot), following: analysis.ipynb

About

a simulation ("sim") of an asynchronous distributed ("dist") system focusing on logical clocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors