# yousefkotp/cpu-scheduling-algorithms architecture

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

- Interactive diagram: https://gitdiagram.com/yousefkotp/cpu-scheduling-algorithms
- Repository: https://github.com/yousefkotp/cpu-scheduling-algorithms

## Overview

This is a command-line CPU-scheduling simulator. Its workflow reads a mode, selected algorithms and process definitions from standard input, parses them into shared state, runs each selected scheduler, then prints either a timeline trace or scheduling statistics. The README documents FCFS, RR, SPN, SRT, HRRN, feedback variants and aging; the sampled implementation places these algorithms in main.cpp. The graph groups those documented variants together. Source excerpts show parsing, dispatch and output, but do not expose every algorithm body or the statistics calculations.

Main entry points: [`main.cpp`](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp) (Algorithm dispatcher), [`parser.h`](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/parser.h) (Input parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input parsing"]
  node_parser["Input parser<br/>[parser.h]"]
end

subgraph group_scheduling["Scheduling"]
  node_dispatcher["Algorithm dispatcher<br/>[main.cpp]"]
  node_fcfs["FCFS<br/>[main.cpp]"]
  node_rr["Round Robin<br/>[main.cpp]"]
  node_spn["Shortest Process<br/>[main.cpp]"]
  node_srt["Shortest Remaining<br/>[main.cpp]"]
  node_hrrn["Response Ratio<br/>[main.cpp]"]
  node_feedback["Feedback queues<br/>[main.cpp]"]
  node_aging["Aging<br/>[main.cpp]"]
end

subgraph group_results["Results"]
  node_timeline["Execution timeline<br/>[main.cpp]"]
  node_trace["Trace output<br/>[main.cpp]"]
  node_statistics["Statistics output<br/>[main.cpp]"]
end

node_user(("CLI user"))

node_user -->|"provides input"| node_parser
node_parser -->|"loads state for"| node_dispatcher
node_dispatcher -.->|"dispatches"| node_fcfs
node_dispatcher -.->|"dispatches"| node_rr
node_dispatcher -.->|"dispatches"| node_spn
node_dispatcher -.->|"dispatches"| node_srt
node_dispatcher -.->|"dispatches"| node_hrrn
node_dispatcher -->|"dispatches"| node_feedback
node_dispatcher -->|"dispatches"| node_aging
node_fcfs -.->|"records execution"| node_timeline
node_rr -->|"records execution"| node_timeline
node_spn -.->|"records execution"| node_timeline
node_srt -.->|"records execution"| node_timeline
node_hrrn -->|"records execution"| node_timeline
node_feedback -->|"records execution"| node_timeline
node_aging -->|"records execution"| node_timeline
node_dispatcher -->|"prints when tracing"| node_trace
node_dispatcher -->|"prints when requested"| node_statistics

click node_parser "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/parser.h"
click node_dispatcher "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_fcfs "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_rr "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_spn "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_srt "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_hrrn "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_feedback "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_aging "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_timeline "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_trace "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"
click node_statistics "https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp"

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_parser,node_user toneBlue
class node_dispatcher,node_fcfs,node_rr,node_spn,node_srt,node_hrrn,node_feedback,node_aging toneAmber
class node_timeline,node_trace,node_statistics toneMint
```

## Components

### Input parsing

- [Input parser](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/parser.h): `parser.h`

### Scheduling

- [Algorithm dispatcher](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [FCFS](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Round Robin](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Shortest Process](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Shortest Remaining](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Response Ratio](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Feedback queues](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Aging](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`

### Results

- [Execution timeline](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Trace output](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`
- [Statistics output](https://github.com/yousefkotp/cpu-scheduling-algorithms/blob/main/main.cpp): `main.cpp`

### Other components

- **CLI user**

## Connections

- CLI user → Input parser: provides input (evidence: `parser.h`)
- Input parser → Algorithm dispatcher: loads state for (evidence: `main.cpp`)
- Algorithm dispatcher → FCFS: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Round Robin: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Shortest Process: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Shortest Remaining: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Response Ratio: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Feedback queues: dispatches (evidence: `main.cpp`)
- Algorithm dispatcher → Aging: dispatches (evidence: `main.cpp`)
- FCFS → Execution timeline: records execution (evidence: `main.cpp`)
- Round Robin → Execution timeline: records execution (evidence: `main.cpp`)
- Shortest Process → Execution timeline: records execution (evidence: `main.cpp`)
- Shortest Remaining → Execution timeline: records execution (evidence: `main.cpp`)
- Response Ratio → Execution timeline: records execution (evidence: `main.cpp`)
- Feedback queues → Execution timeline: records execution (evidence: `main.cpp`)
- Aging → Execution timeline: records execution (evidence: `main.cpp`)
- Algorithm dispatcher → Trace output: prints when tracing (evidence: `main.cpp`)
- Algorithm dispatcher → Statistics output: prints when requested (evidence: `main.cpp`)
