Skip to content

About

Cross-platform desktop application for real-time OS thread scheduling simulation (FCFS, RR) built with C++ and Qt.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Thread Scheduler Visualizer

Thread Scheduler Visualizer is a cross-platform desktop application designed to model, simulate, and analyze operating system thread scheduling algorithms in real time. Built with C++17 and Qt/QML, it provides an intuitive graphical interface for examining CPU scheduling mechanics, context switches, thread states, and performance metrics.


Key Features

  • Core Scheduling Algorithms: Out-of-the-box support for First-Come, First-Served (FCFS), Round Robin (RR), Shortest Job First (SJF), Shortest Remaining Time First (SRTF), Priority Scheduling (with aging), and Multi-Level Feedback Queue (MLFQ).
  • Real-Time Simulation & Control: Interactive timeline control with play, pause, step forward/backward, and timer adjustments.
  • Dynamic Themes & Performance Toggles: Full support for switching between Light and Dark themes, alongside a performance toggle to enable or disable heavy graphical animations for lower-end hardware.
  • Comparative Analysis Dashboard: Dedicated side-by-side metrics table and visual bar charts for evaluating throughput, turnaround time, waiting time, and Jain's fairness index across multiple algorithms.
  • Comprehensive Metrics: Live tracking of Turnaround Time, Waiting Time, Response Time, Context Switches, and CPU Utilization.
  • Cross-Platform GUI: Native desktop experience across Windows and Linux, featuring vectorized icons and clean window architecture without unwanted console popups.
  • Robust Containerized Environment: Docker support and GitHub Actions CI pipelines ensuring reproducible builds and automated testing.

Tech Stack

  • Language: C++17
  • Framework: Qt 5 (Core, GUI, Qml, Quick, Svg)
  • Build System: CMake (>= 3.16), Ninja
  • Testing: GoogleTest
  • CI/CD & Virtualization: GitHub Actions, Docker (Ubuntu 22.04 LTS)

Prerequisites & System Requirements

Before building the project, ensure your system has the following dependencies installed:

  • C++ Compiler supporting C++17 (MSVC 2019+, GCC 11+, or Clang)
  • CMake (version 3.16 or higher)
  • Qt 5 development libraries
    • On Ubuntu/Debian: sudo apt-get install build-essential cmake qtbase5-dev qtdeclarative5-dev libqt5svg5-dev qml-module-qtquick2

Installation & Building from Source

  1. Clone the repository
  2. Configure the project with CMake:
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
  1. Build the application:
cmake --build build --config Release
  1. Run the executable:
    • Windows:
      build\Release\thread_scheduler_visualizer.exe
      
    • Linux:
      ./build/thread_scheduler_visualizer
      

Running Tests

The project includes unit tests for core scheduling algorithms using GoogleTest. To run them:

  1. Build with tests enabled (-DBUILD_TESTS=ON).
  2. Execute tests via CTest:
ctest --test-dir build --output-on-failure

Dockerized Development & Testing

If you prefer an isolated environment or want to run automated tests and execute the GUI application via Docker:

  1. Build the Docker image (this will automatically compile the project and run all unit tests via CTest):
docker build --no-cache -t thread-scheduler-visualizer -f docker/Dockerfile .
  1. Run the application with GUI support (X11 / XLaunch):
    • On Windows (make sure XLaunch / VcXsrv is running with «Disable access control» enabled):
      docker run --rm -it `
        -e DISPLAY="host.docker.internal:0.0" `
        -v /tmp/.X11-unix:/tmp/.X11-unix `
        thread-scheduler-visualizer `
        ./build/thread_scheduler_visualizer
      
    • On Linux:
      xhost +local:docker
      docker run --rm -it \
        -e DISPLAY=$DISPLAY \
        -v /tmp/.X11-unix:/tmp/.X11-unix \
        thread-scheduler-visualizer \
        ./build/thread_scheduler_visualizer

Usage Guide

  1. Launch the application.
  2. Select the desired scheduling algorithm from the interface controls.
  3. Configure thread parameters (burst time, arrival time, priority, etc.).
  4. Use the playback controls to observe the real-time simulation timeline and context switches.
  5. Review the calculated performance metrics in the analytics panel or open the comparative analysis dashboard.

License

Distributed under the MIT License. See LICENSE for more information.


Documentation

  • Glossary — Definitions for core OS scheduling terminology, scheduling policies, thread states, and architectural components.
  • Architecture Documentation — Architectural diagrams (Class, Sequence, FSM) and system component interactions.

Preview Screenshots

Main Window Screenshot


Project Structure

Click to expand the project structure
thread-scheduler-visualizer/
├── .github/
│   └── workflows/
│       ├── ci.yml                    # GitHub Actions CI pipeline
│       ├── readme-check.yml          # Auto-check README updates on structure changes
│       └── release.yml               # Automated release workflow
├── docker/
│   └── Dockerfile                    # Linux build environment container
├── docs
│   ├── adr/
│   │   ├── 0001-record-architecture-decisions.md
│   │   ├── 0002-cplusplus-qt-stack.md
│   │   ├── 0003-core-gui-separation.md
│   └── ARCHITECTURE.md               # System architecture & class diagrams
├── include/
│   ├── core/
│   │   ├── BenchmarkRunner.h         # Benchmark runner interface for performance testing
│   │   ├── EventLogger.h             # Event logging interface
│   │   ├── FCFSScheduler.h           # First-Come, First-Served algorithm interface
│   │   ├── ISceduler.h               # Abstract scheduler interface for polymorphism
│   │   ├── MetricsCalculator.h       # Performance metrics calculation interface
│   │   ├── MLFQScheduler.h           # Multi-Level Feedback Queue algorithm interface
│   │   ├── PCB.h                     # Process Control Block class interface
│   │   ├── PriorityScheduler.h       # Priority scheduling algorithm interface
│   │   ├── RRScheduler.h             # Round Robin algorithm interface
│   │   ├── Scheduler.h               # Abstract base scheduler interface
│   │   ├── SchedulerFactory.h        # Scheduler factory interface
│   │   ├── SimulationWorker.h        # Worker thread interface for simulation execution
│   │   ├── ScedulerTypes.h           # Scheduler type enum & constants
│   │   ├── SimulationEvent.h         # Simulation event structure & EventType enum
│   │   ├── SJFScheduler.h            # Shortest Job First algorithm interface
│   │   ├── SRTFScheduler.h           # Shortest Remaining Time First algorithm interface
│   │   ├── Thread.h                  # Thread structure & ThreadState enum
│   │   └── WorkloadScenario.h        # Workload scenario interface for testing
│   └── gui/
│       ├── BenchmarkWindow.h         # Benchmarking window interface
│       ├── GanttChartModel.h         # Gantt chart data model for QML binding
│       ├── GUIController.h           # Qt/QML bridge & ViewModel interface
│       ├── ReadyQueueModel.h         # Ready queue data model for QML binding
│       └── ThreadListModel.h         # Thread list data model for QML binding
├── resources/
│   ├── icons/
│   │   ├── app_icon.ico              # Windows multi-resolution icon
│   │   └── app_icon.svg              # Cross-platform vector icon source
│   ├── app.rc                        # Qt resource file for icon mapping
│   └── preview/
│       └── screenshot.png            # Preview screenshot for README
├── src/
│   ├── core/
│   │   ├── BenchmarkRunner.cpp       # Benchmark runner implementation
│   │   ├── EventLogger.cpp           # Event logging implementation
│   │   ├── FCFSScheduler.cpp         # FCFS algorithm implementation
│   │   ├── MetricsCalculator.cpp     # Metrics calculation implementation
│   │   ├── MLFQScheduler.cpp         # MLFQ algorithm implementation
│   │   ├── PCB.cpp                   # PCB implementation
│   │   ├── PriorityScheduler.cpp     # Priority algorithm implementation
│   │   ├── RealExecutionManager.cpp  # Real execution manager implementation
│   │   ├── RRScheduler.cpp           # Round Robin algorithm implementation
│   │   ├── SchedulerFactory.cpp      # Scheduler factory implementation
│   │   ├── SimulationWorker.cpp      # Worker thread implementation
│   │   ├── SJFScheduler.cpp          # SJF algorithm implementation
│   │   ├── SRTFScheduler.cpp         # SRTF algorithm implementation
│   │   ├── Thread.cpp                # Thread helpers implementation
│   │   └── WorkloadScenario.cpp      # Workload scenario implementation
│   ├── gui/
│   │   ├── BenchmarkWindow.cpp       # Benchmarking window implementation
│   │   ├── GanttChartModel.cpp       # Gantt chart model implementation
│   │   ├── GUIController.cpp         # ViewModel implementation & Qt bindings
│   │   ├── ReadyQueueModel.cpp       # Ready queue model implementation
│   │   └── ThreadListModel.cpp       # Thread list model implementation
│   ├── qml/
│   │   ├── BenchmarkWindow.qml       # Benchmarking window & QML layout
│   │   ├── main.qml                  # Main application window & QML UI layout
│   │   └── ThreadStateDiagram.qml    # Thread state diagram & QML animation
│   ├── main.cpp                      # Entry point / Cross-platform icon loader
│   └── qml.qrc                       # Qt resource bundle for QML assets
├── tests/
│   ├── benchmarks/
│   │   └── benchmark_schedulers.cpp
│   ├── core/
│   │   └── test_simulation_invariants.cpp
│   └── unit/
│       ├── TestThreadFSM.cpp
│       ├── test_benchmark_runner.cpp
│       ├── test_context_switch.cpp
│       ├── test_event_logger.cpp
│       ├── test_fcfs_scheduler.cpp
│       ├── test_metrics_calculator.cpp
│       ├── test_mlfq_scheduler.cpp
│       ├── test_parameterized_schedulers.cpp
│       ├── test_priority_scheduler.cpp
│       ├── test_rr_scheduler.cpp
│       ├── test_scheduler_factory.cpp
│       └── test_sjf_srtf_scheduler.cpp
├── CMakeLists.txt                    # Root CMake build configuration
├── CMakePresets.json                 # Standard CMake build presets
├── Doxyfile                          # Doxygen configuration for API documentation
├── GLOSSARY.md                       # Project domain glossary & technical definitions
├── LICENSE                           # License file
├── resources.qrc                     # Qt resource bundle (icons mapping)
├── .gitignore                        # Git ignore rules
└── README.md                         # Project documentation

Code Coverage

About

Cross-platform desktop application for real-time OS thread scheduling simulation (FCFS, RR) built with C++ and Qt.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages