# adityaph-17/cpu-scheduling-lab architecture

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

- Interactive diagram: https://gitdiagram.com/adityaph-17/cpu-scheduling-lab
- Repository: https://github.com/adityaph-17/cpu-scheduling-lab

## Overview

CPU Scheduling Lab is a Flask-backed teaching platform for entering process workloads, simulating or comparing six scheduling algorithms, and visualizing schedules and their underlying data structures. The main flow runs from the browser through API validation and scheduling to JSON results rendered in the frontend. The algorithms, data structures, and process model are supported by sampled source; UI/API wiring is shown where excerpts document it. The HTML template and styling are present in the tree but were not sampled, so their internal behavior is not inferred.

Main entry points: [`app.py`](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/app.py) (Flask API), [`scheduler/algorithms.py`](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py) (Algorithm simulation), [`static/script.js`](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/script.js) (Scheduling UI), [`templates/index.html`](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/templates/index.html) (Lab page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_browser["Scheduling UI<br/>[script.js]"]
  node_page["Lab page<br/>[index.html]"]
  node_visuals["Schedule visualizations<br/>[script.js]"]
  node_styles["Interface styling<br/>[style.css]"]
end

subgraph group_api["API layer"]
  node_server["Flask API<br/>[app.py]"]
  node_presets["Workload presets<br/>[app.py]"]
end

subgraph group_engine["Scheduling engine"]
  node_validation["Input validation<br/>[algorithms.py]"]
  node_simulation["Algorithm simulation<br/>[algorithms.py]"]
  node_comparison["Algorithm comparison<br/>[algorithms.py]"]
  node_metrics["Schedule metrics<br/>[algorithms.py]"]
end

subgraph group_domain["Scheduling primitives"]
  node_heap["Min-heap<br/>[data_structures.py]"]
  node_queue["FIFO queue<br/>[data_structures.py]"]
  node_process["Process lifecycle<br/>[process.py]"]
end

node_learner(("Learner"))

node_learner -->|"enters workload"| node_browser
node_server -->|"renders"| node_page
node_browser -->|"requests comparison"| node_server
node_server -->|"serves presets"| node_presets
node_server -->|"validates input"| node_validation
node_server -->|"runs simulation"| node_simulation
node_server -->|"runs comparison"| node_comparison
node_validation -.->|"creates processes"| node_process
node_simulation -->|"uses"| node_heap
node_simulation -->|"uses"| node_queue
node_simulation -->|"executes processes"| node_process
node_comparison -.->|"runs algorithms"| node_simulation
node_simulation -->|"calculates"| node_metrics
node_server -->|"returns JSON results"| node_browser
node_browser -->|"renders results"| node_visuals
node_visuals -.->|"visualizes snapshots"| node_heap
node_visuals -.->|"visualizes snapshots"| node_queue
node_browser -.->|"uses styles"| node_styles
node_page -.->|"loads interface code"| node_browser

click node_browser "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/script.js"
click node_page "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/templates/index.html"
click node_visuals "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/script.js"
click node_styles "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/style.css"
click node_server "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/app.py"
click node_presets "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/app.py"
click node_validation "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py"
click node_simulation "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py"
click node_comparison "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py"
click node_metrics "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py"
click node_heap "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/data_structures.py"
click node_queue "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/data_structures.py"
click node_process "https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/process.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_browser,node_page,node_visuals,node_styles toneBlue
class node_server,node_presets toneAmber
class node_validation,node_simulation,node_comparison,node_metrics toneMint
class node_heap,node_queue,node_process toneRose
class node_learner toneIndigo
```

## Components

### Web interface

- [Scheduling UI](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/script.js): `static/script.js`
- [Lab page](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/templates/index.html): `templates/index.html`
- [Schedule visualizations](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/script.js): `static/script.js`
- [Interface styling](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/static/style.css): `static/style.css`

### API layer

- [Flask API](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/app.py): `app.py`
- [Workload presets](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/app.py): `app.py`

### Scheduling engine

- [Input validation](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py): `scheduler/algorithms.py`
- [Algorithm simulation](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py): `scheduler/algorithms.py`
- [Algorithm comparison](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py): `scheduler/algorithms.py`
- [Schedule metrics](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/algorithms.py): `scheduler/algorithms.py`

### Scheduling primitives

- [Min-heap](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/data_structures.py): `scheduler/data_structures.py`
- [FIFO queue](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/data_structures.py): `scheduler/data_structures.py`
- [Process lifecycle](https://github.com/adityaph-17/cpu-scheduling-lab/blob/main/scheduler/process.py): `scheduler/process.py`

### Other components

- **Learner**

## Connections

- Learner → Scheduling UI: enters workload (evidence: `static/script.js`)
- Flask API → Lab page: renders (evidence: `app.py`)
- Scheduling UI → Flask API: requests comparison (evidence: `static/script.js`)
- Flask API → Workload presets: serves presets (evidence: `app.py`)
- Flask API → Input validation: validates input (evidence: `app.py`)
- Flask API → Algorithm simulation: runs simulation (evidence: `app.py`)
- Flask API → Algorithm comparison: runs comparison (evidence: `app.py`)
- Input validation → Process lifecycle: creates processes (evidence: `scheduler/algorithms.py`)
- Algorithm simulation → Min-heap: uses (evidence: `scheduler/algorithms.py`)
- Algorithm simulation → FIFO queue: uses (evidence: `scheduler/algorithms.py`)
- Algorithm simulation → Process lifecycle: executes processes (evidence: `scheduler/algorithms.py`)
- Algorithm comparison → Algorithm simulation: runs algorithms (evidence: `scheduler/algorithms.py`)
- Algorithm simulation → Schedule metrics: calculates (evidence: `scheduler/algorithms.py`)
- Flask API → Scheduling UI: returns JSON results (evidence: `app.py`)
- Scheduling UI → Schedule visualizations: renders results (evidence: `static/script.js`)
- Schedule visualizations → Min-heap: visualizes snapshots
- Schedule visualizations → FIFO queue: visualizes snapshots
- Scheduling UI → Interface styling: uses styles
- Lab page → Scheduling UI: loads interface code
