# freakshowzzz/fcfs-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/freakshowzzz/fcfs-simulator
- Repository: https://github.com/freakshowzzz/fcfs-simulator

## Overview

This browser-based FCFS Scheduling Simulator lets users add, edit, and remove processes, then run a first-come-first-served schedule and inspect its timeline, per-process results, averages, explanations, and insight. The main script owns process state and button/event handling; it calls the pure scheduling algorithm and passes its outcome to separate UI renderers. The README documents the page’s CSS and script loading. The sampled source shows the runtime calls; the README supplies the page-link relationships.

Main entry points: [`js/main.js`](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/main.js) (Event and state handler), [`index.html`](https://github.com/freakshowzzz/fcfs-simulator/blob/main/index.html) (Page structure), [`css/style.css`](https://github.com/freakshowzzz/fcfs-simulator/blob/main/css/style.css) (Responsive styling), [`js/fcfs.js`](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/fcfs.js) (FCFS scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_page["Page and styling"]
  node_html["Page structure<br/>[index.html]"]
  node_styles["Responsive styling<br/>[style.css]"]
end

subgraph group_control["Simulation control"]
  node_controller["Event and state handler<br/>[main.js]"]
  node_processes["Process list<br/>[main.js]"]
end

subgraph group_scheduling["FCFS scheduling"]
  node_scheduler["FCFS scheduler<br/>[fcfs.js]"]
end

subgraph group_presentation["Results presentation"]
  node_table["Process table<br/>[ui.js]"]
  node_chart["Gantt chart<br/>[ui.js]"]
  node_results["Process results<br/>[ui.js]"]
  node_stats["Summary statistics<br/>[ui.js]"]
  node_explanations["Process explanations<br/>[ui.js]"]
  node_insight["Scheduling insight<br/>[ui.js]"]
end

node_user(("User"))

node_user -->|"clicks controls"| node_controller
node_html -->|"links stylesheet"| node_styles
node_html -->|"loads scripts"| node_controller
node_controller -->|"updates"| node_processes
node_controller -->|"renders table"| node_table
node_controller -->|"runs schedule"| node_scheduler
node_controller -->|"renders timeline"| node_chart
node_controller -->|"renders results"| node_results
node_controller -->|"renders summary"| node_stats
node_controller -->|"renders explanations"| node_explanations
node_controller -->|"renders insight"| node_insight

click node_html "https://github.com/freakshowzzz/fcfs-simulator/blob/main/index.html"
click node_styles "https://github.com/freakshowzzz/fcfs-simulator/blob/main/css/style.css"
click node_controller "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/main.js"
click node_processes "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/main.js"
click node_scheduler "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/fcfs.js"
click node_table "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"
click node_chart "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"
click node_results "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"
click node_stats "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"
click node_explanations "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"
click node_insight "https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js"

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_html,node_styles,node_user toneBlue
class node_controller,node_processes toneAmber
class node_scheduler toneMint
class node_table,node_chart,node_results,node_stats,node_explanations,node_insight toneRose
```

## Components

### Page and styling

- [Page structure](https://github.com/freakshowzzz/fcfs-simulator/blob/main/index.html): `index.html`
- [Responsive styling](https://github.com/freakshowzzz/fcfs-simulator/blob/main/css/style.css): `css/style.css`

### Simulation control

- [Event and state handler](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/main.js): `js/main.js`
- [Process list](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/main.js): `js/main.js`

### FCFS scheduling

- [FCFS scheduler](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/fcfs.js): `js/fcfs.js`

### Results presentation

- [Process table](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`
- [Gantt chart](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`
- [Process results](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`
- [Summary statistics](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`
- [Process explanations](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`
- [Scheduling insight](https://github.com/freakshowzzz/fcfs-simulator/blob/main/js/ui.js): `js/ui.js`

### Other components

- **User**

## Connections

- User → Event and state handler: clicks controls (evidence: `js/main.js`)
- Page structure → Responsive styling: links stylesheet (evidence: `README.md`)
- Page structure → Event and state handler: loads scripts (evidence: `README.md`)
- Event and state handler → Process list: updates (evidence: `js/main.js`)
- Event and state handler → Process table: renders table (evidence: `js/main.js`)
- Event and state handler → FCFS scheduler: runs schedule (evidence: `js/main.js`)
- Event and state handler → Gantt chart: renders timeline (evidence: `js/main.js`)
- Event and state handler → Process results: renders results (evidence: `js/main.js`)
- Event and state handler → Summary statistics: renders summary (evidence: `js/main.js`)
- Event and state handler → Process explanations: renders explanations (evidence: `js/main.js`)
- Event and state handler → Scheduling insight: renders insight (evidence: `js/main.js`)
