# rudr-1705/adaptivesched architecture

> Architecture diagram of the GitHub repository rudr-1705/adaptivesched, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rudr-1705/adaptivesched
- Repository: https://github.com/rudr-1705/adaptivesched

## Overview

AdaptiveSched++ is a single-core CPU scheduling simulator. Its main workflow loads or generates a workload, injects processes into a simulation coordinated by the controller, executes them through an adaptive scheduler and CPU engine, and reports performance metrics. The adaptive scheduler selects among policy implementations and can migrate queued work when switching. The README also documents benchmarking and an interactive comparison dashboard. Relationships for unsampled features are included only where the README documents them; source excerpts do not expose every runtime connection.

Main entry points: [`src/simulation/simulation_controller.cpp`](https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/simulation_controller.cpp) (Simulation Controller), [`src/scheduler/adaptive.cpp`](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/adaptive.cpp) (Adaptive Scheduler), [`src/core/ready_queue.cpp`](https://github.com/rudr-1705/adaptivesched/blob/main/src/core/ready_queue.cpp) (Ready Queue), [`src/execution/cpu.cpp`](https://github.com/rudr-1705/adaptivesched/blob/main/src/execution/cpu.cpp) (CPU Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_cli["CLI Entry<br/>[main.cpp]"]
  node_workload["Workload Loader<br/>[workload.cpp]"]
  node_generator["Process Generator"]
  node_controller["Simulation Controller"]
end

subgraph group_scheduling["Scheduling"]
  node_scheduler_api["Scheduler Interface<br/>[scheduler.cpp]"]
  node_adaptive["Adaptive Scheduler<br/>[adaptive.cpp]"]
  node_fcfs["FCFS Policy<br/>[fcfs.cpp]"]
  node_sjf["SJF Policy<br/>[sjf.cpp]"]
  node_rr["Round Robin<br/>[rr.cpp]"]
  node_priority["Priority Policy<br/>[priority.cpp]"]
  node_mlfq["MLFQ Policy<br/>[mlfq.cpp]"]
end

subgraph group_runtime["Runtime Core"]
  node_cpu["CPU Engine<br/>[cpu.cpp]"]
  node_clock["Logical Clock<br/>[clock.cpp]"]
  node_process["Process State<br/>[process.cpp]"]
  node_queue["Ready Queue<br/>[ready_queue.cpp]"]
end

subgraph group_analysis["Analysis Tools"]
  node_metrics["Statistics Engine<br/>[statistics.cpp]"]
  node_benchmark["Benchmark Runner<br/>[benchmark.py]"]
  node_dashboard["Interactive Dashboard"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_cli -->|"starts"| node_controller
node_cli -->|"loads profile"| node_workload
node_controller -->|"resets"| node_clock
node_controller -->|"creates"| node_adaptive
node_controller -->|"creates"| node_cpu
node_controller -->|"starts"| node_generator
node_controller -->|"records ticks"| node_metrics
node_workload -->|"supplies descriptors"| node_generator
node_generator -.->|"injects processes"| node_controller
node_cpu -->|"dispatches through"| node_adaptive
node_cpu -.->|"advances"| node_clock
node_cpu -->|"completion callback"| node_controller
node_adaptive -->|"delegates to"| node_fcfs
node_adaptive -->|"delegates to"| node_rr
node_adaptive -->|"delegates to"| node_priority
node_adaptive -->|"delegates to"| node_mlfq
node_scheduler_api -->|"uses"| node_queue
node_fcfs -->|"uses"| node_queue
node_sjf -->|"uses"| node_queue
node_rr -->|"uses"| node_queue
node_priority -->|"uses"| node_queue
node_mlfq -->|"uses"| node_queue
node_adaptive -.->|"reports metrics"| node_metrics
node_metrics -.->|"benchmarks results"| node_benchmark
node_benchmark -->|"visualizes comparisons"| node_dashboard

click node_cli "https://github.com/rudr-1705/adaptivesched/blob/main/main.cpp"
click node_workload "https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/workload.cpp"
click node_generator "https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/process_generator.cpp"
click node_controller "https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/simulation_controller.cpp"
click node_cpu "https://github.com/rudr-1705/adaptivesched/blob/main/src/execution/cpu.cpp"
click node_clock "https://github.com/rudr-1705/adaptivesched/blob/main/src/core/clock.cpp"
click node_process "https://github.com/rudr-1705/adaptivesched/blob/main/src/core/process.cpp"
click node_queue "https://github.com/rudr-1705/adaptivesched/blob/main/src/core/ready_queue.cpp"
click node_scheduler_api "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/scheduler.cpp"
click node_adaptive "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/adaptive.cpp"
click node_fcfs "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/fcfs.cpp"
click node_sjf "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/sjf.cpp"
click node_rr "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/rr.cpp"
click node_priority "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/priority.cpp"
click node_mlfq "https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/mlfq.cpp"
click node_metrics "https://github.com/rudr-1705/adaptivesched/blob/main/src/metrics/statistics.cpp"
click node_benchmark "https://github.com/rudr-1705/adaptivesched/blob/main/benchmark.py"
click node_dashboard "https://github.com/rudr-1705/adaptivesched/blob/main/generate_dashboard.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_workload,node_generator,node_controller,node_user toneBlue
class node_scheduler_api,node_adaptive,node_fcfs,node_sjf,node_rr,node_priority,node_mlfq toneAmber
class node_cpu,node_clock,node_process,node_queue toneMint
class node_metrics,node_benchmark,node_dashboard toneRose
```

## Components

### Simulation

- [CLI Entry](https://github.com/rudr-1705/adaptivesched/blob/main/main.cpp): `main.cpp`
- [Workload Loader](https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/workload.cpp): `src/simulation/workload.cpp`
- [Process Generator](https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/process_generator.cpp): `src/simulation/process_generator.cpp`
- [Simulation Controller](https://github.com/rudr-1705/adaptivesched/blob/main/src/simulation/simulation_controller.cpp): `src/simulation/simulation_controller.cpp`

### Scheduling

- [Scheduler Interface](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/scheduler.cpp): `src/scheduler/scheduler.cpp`
- [Adaptive Scheduler](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/adaptive.cpp): `src/scheduler/adaptive.cpp`
- [FCFS Policy](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/fcfs.cpp): `src/scheduler/fcfs.cpp`
- [SJF Policy](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/sjf.cpp): `src/scheduler/sjf.cpp`
- [Round Robin](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/rr.cpp): `src/scheduler/rr.cpp`
- [Priority Policy](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/priority.cpp): `src/scheduler/priority.cpp`
- [MLFQ Policy](https://github.com/rudr-1705/adaptivesched/blob/main/src/scheduler/mlfq.cpp): `src/scheduler/mlfq.cpp`

### Runtime Core

- [CPU Engine](https://github.com/rudr-1705/adaptivesched/blob/main/src/execution/cpu.cpp): `src/execution/cpu.cpp`
- [Logical Clock](https://github.com/rudr-1705/adaptivesched/blob/main/src/core/clock.cpp): `src/core/clock.cpp`
- [Process State](https://github.com/rudr-1705/adaptivesched/blob/main/src/core/process.cpp): `src/core/process.cpp`
- [Ready Queue](https://github.com/rudr-1705/adaptivesched/blob/main/src/core/ready_queue.cpp): `src/core/ready_queue.cpp`

### Analysis Tools

- [Statistics Engine](https://github.com/rudr-1705/adaptivesched/blob/main/src/metrics/statistics.cpp): `src/metrics/statistics.cpp`
- [Benchmark Runner](https://github.com/rudr-1705/adaptivesched/blob/main/benchmark.py): `benchmark.py`
- [Interactive Dashboard](https://github.com/rudr-1705/adaptivesched/blob/main/generate_dashboard.py): `generate_dashboard.py`

### Other components

- **User**

## Connections

- User → CLI Entry: runs (evidence: `readme.md`)
- CLI Entry → Simulation Controller: starts (evidence: `main.cpp`)
- CLI Entry → Workload Loader: loads profile (evidence: `main.cpp`)
- Simulation Controller → Logical Clock: resets (evidence: `src/simulation/simulation_controller.cpp`)
- Simulation Controller → Adaptive Scheduler: creates (evidence: `src/simulation/simulation_controller.cpp`)
- Simulation Controller → CPU Engine: creates (evidence: `src/simulation/simulation_controller.cpp`)
- Simulation Controller → Process Generator: starts (evidence: `src/simulation/simulation_controller.cpp`)
- Simulation Controller → Statistics Engine: records ticks (evidence: `src/simulation/simulation_controller.cpp`)
- Workload Loader → Process Generator: supplies descriptors
- Process Generator → Simulation Controller: injects processes
- CPU Engine → Adaptive Scheduler: dispatches through
- CPU Engine → Logical Clock: advances
- CPU Engine → Simulation Controller: completion callback (evidence: `src/simulation/simulation_controller.cpp`)
- Adaptive Scheduler → FCFS Policy: delegates to
- Adaptive Scheduler → Round Robin: delegates to
- Adaptive Scheduler → Priority Policy: delegates to
- Adaptive Scheduler → MLFQ Policy: delegates to
- Scheduler Interface → Ready Queue: uses
- FCFS Policy → Ready Queue: uses
- SJF Policy → Ready Queue: uses
- Round Robin → Ready Queue: uses
- Priority Policy → Ready Queue: uses
- MLFQ Policy → Ready Queue: uses
- Adaptive Scheduler → Statistics Engine: reports metrics
- Statistics Engine → Benchmark Runner: benchmarks results
- Benchmark Runner → Interactive Dashboard: visualizes comparisons (evidence: `readme.md`)
