# reneshasagar/os-simulator- architecture

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

- Interactive diagram: https://gitdiagram.com/reneshasagar/os-simulator-
- Repository: https://github.com/reneshasagar/os-simulator-

## Overview

OS Simulator is an educational web platform backed by a C++ REST simulation engine. Users choose a workspace, submit CPU, memory, or paging inputs, and explore algorithm results through metrics, timelines, visual state graphs, and theory/verification views; a separate Ask OS tutor provides chat, history, and search. The backend validates requests, dispatches simulations, and returns JSON. Edges follow shown imports, route handlers, API paths, or README descriptions; some memory-session details and chatbot internals are documented but not shown in source excerpts.

Main entry points: [`backend/server/api.cpp`](https://github.com/reneshasagar/os-simulator-/blob/main/backend/server/api.cpp) (REST API routes), [`frontend/src/App.tsx`](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/App.tsx) (Tabbed workspace), [`frontend/src/api/client.ts`](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/api/client.ts) (API client), [`frontend/src/components/CpuSchedulingView.tsx`](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/CpuSchedulingView.tsx) (CPU workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_app["Tabbed workspace<br/>[App.tsx]"]
  node_cube["Glass cube"]
  node_chat["OS tutor<br/>[OsChatbotView.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_types["Simulator types<br/>[simulator.ts]"]
end

subgraph group_cpu["CPU scheduling"]
  node_cpu_view["CPU workspace"]
  node_cpu_graph["Playback graph"]
  node_cpu_theory["Theory and proofs<br/>[VivaAccordion.tsx]"]
  node_scheduler["Scheduling engine<br/>[scheduler.cpp]"]
end

subgraph group_memory["Memory management"]
  node_memory_view["Memory workspace"]
  node_memory_manager["Partition allocator<br/>[memory_manager.cpp]"]
  node_memory_state[("Memory session state<br/>[api.h]")]
end

subgraph group_paging["Virtual memory"]
  node_paging_view["Paging workspace"]
  node_page_graph["Frame playback graph"]
  node_page_theory["Theory and proofs<br/>[VivaAccordion.tsx]"]
  node_page_replacer["Page replacement engine"]
end

node_learner(("Learner"))
node_api_server["REST API routes<br/>[api.cpp]"]
node_validation["Request validation<br/>[validation.cpp]"]
node_server_entry["Server entrypoint<br/>[main.cpp]"]

node_learner -->|"uses"| node_app
node_app -->|"opens"| node_cpu_view
node_app -->|"opens"| node_memory_view
node_app -->|"opens"| node_paging_view
node_app -->|"opens"| node_chat
node_app -->|"renders"| node_cube
node_app -->|"checks health"| node_api_client
node_cpu_view -->|"requests results"| node_api_client
node_memory_view -->|"requests results"| node_api_client
node_paging_view -->|"requests results"| node_api_client
node_cpu_view -->|"renders"| node_cpu_graph
node_cpu_view -->|"renders"| node_cpu_theory
node_memory_view -->|"renders"| node_cpu_graph
node_memory_view -->|"renders"| node_cpu_theory
node_paging_view -->|"renders"| node_page_graph
node_paging_view -->|"renders"| node_page_theory
node_api_client -->|"uses types"| node_types
node_api_client -->|"sends requests"| node_api_server
node_server_entry -->|"starts"| node_api_server
node_api_server -->|"validates inputs"| node_validation
node_api_server -->|"dispatches scheduling"| node_scheduler
node_api_server -->|"dispatches paging"| node_page_replacer
node_api_server -.->|"dispatches allocation"| node_memory_manager
node_api_server -.->|"maintains session"| node_memory_state
node_api_client -->|"calls API routes"| node_api_server

click node_app "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/App.tsx"
click node_cube "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/TransparentGlassCube.tsx"
click node_chat "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/OsChatbotView.tsx"
click node_api_client "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/api/client.ts"
click node_types "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/types/simulator.ts"
click node_cpu_view "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/CpuSchedulingView.tsx"
click node_cpu_graph "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/InteractiveGraphView.tsx"
click node_cpu_theory "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/VivaAccordion.tsx"
click node_scheduler "https://github.com/reneshasagar/os-simulator-/blob/main/backend/cpu/scheduler.cpp"
click node_memory_view "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/MemoryManagementView.tsx"
click node_memory_manager "https://github.com/reneshasagar/os-simulator-/blob/main/backend/memory/memory_manager.cpp"
click node_paging_view "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/PageReplacementView.tsx"
click node_page_graph "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/InteractiveGraphView.tsx"
click node_page_theory "https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/VivaAccordion.tsx"
click node_page_replacer "https://github.com/reneshasagar/os-simulator-/blob/main/backend/paging/page_replacement.cpp"
click node_api_server "https://github.com/reneshasagar/os-simulator-/blob/main/backend/server/api.cpp"
click node_validation "https://github.com/reneshasagar/os-simulator-/blob/main/backend/utils/validation.cpp"
click node_server_entry "https://github.com/reneshasagar/os-simulator-/blob/main/backend/main.cpp"
click node_memory_state "https://github.com/reneshasagar/os-simulator-/blob/main/backend/server/api.h"

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_app,node_cube,node_chat,node_api_client,node_types toneBlue
class node_cpu_view,node_cpu_graph,node_cpu_theory,node_scheduler toneAmber
class node_memory_view,node_memory_manager,node_memory_state,node_api_server,node_validation,node_server_entry toneMint
class node_paging_view,node_page_graph,node_page_theory,node_page_replacer toneRose
class node_learner toneIndigo
```

## Components

### Web application

- [Tabbed workspace](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Glass cube](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/TransparentGlassCube.tsx): `frontend/src/components/TransparentGlassCube.tsx`
- [OS tutor](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/OsChatbotView.tsx): `frontend/src/components/OsChatbotView.tsx`
- [API client](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Simulator types](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/types/simulator.ts): `frontend/src/types/simulator.ts`

### CPU scheduling

- [CPU workspace](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/CpuSchedulingView.tsx): `frontend/src/components/CpuSchedulingView.tsx`
- [Playback graph](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/InteractiveGraphView.tsx): `frontend/src/components/InteractiveGraphView.tsx`
- [Theory and proofs](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/VivaAccordion.tsx): `frontend/src/components/VivaAccordion.tsx`
- [Scheduling engine](https://github.com/reneshasagar/os-simulator-/blob/main/backend/cpu/scheduler.cpp): `backend/cpu/scheduler.cpp`

### Memory management

- [Memory workspace](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/MemoryManagementView.tsx): `frontend/src/components/MemoryManagementView.tsx`
- [Partition allocator](https://github.com/reneshasagar/os-simulator-/blob/main/backend/memory/memory_manager.cpp): `backend/memory/memory_manager.cpp`
- [Memory session state](https://github.com/reneshasagar/os-simulator-/blob/main/backend/server/api.h): `backend/server/api.h`

### Virtual memory

- [Paging workspace](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/PageReplacementView.tsx): `frontend/src/components/PageReplacementView.tsx`
- [Frame playback graph](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/InteractiveGraphView.tsx): `frontend/src/components/InteractiveGraphView.tsx`
- [Theory and proofs](https://github.com/reneshasagar/os-simulator-/blob/main/frontend/src/components/VivaAccordion.tsx): `frontend/src/components/VivaAccordion.tsx`
- [Page replacement engine](https://github.com/reneshasagar/os-simulator-/blob/main/backend/paging/page_replacement.cpp): `backend/paging/page_replacement.cpp`

### Other components

- **Learner**
- [REST API routes](https://github.com/reneshasagar/os-simulator-/blob/main/backend/server/api.cpp): `backend/server/api.cpp`
- [Request validation](https://github.com/reneshasagar/os-simulator-/blob/main/backend/utils/validation.cpp): `backend/utils/validation.cpp`
- [Server entrypoint](https://github.com/reneshasagar/os-simulator-/blob/main/backend/main.cpp): `backend/main.cpp`

## Connections

- Learner → Tabbed workspace: uses (evidence: `README.md`)
- Tabbed workspace → CPU workspace: opens (evidence: `frontend/src/App.tsx`)
- Tabbed workspace → Memory workspace: opens (evidence: `frontend/src/App.tsx`)
- Tabbed workspace → Paging workspace: opens (evidence: `frontend/src/App.tsx`)
- Tabbed workspace → OS tutor: opens (evidence: `frontend/src/App.tsx`)
- Tabbed workspace → Glass cube: renders (evidence: `frontend/src/App.tsx`)
- Tabbed workspace → API client: checks health (evidence: `frontend/src/App.tsx`)
- CPU workspace → API client: requests results (evidence: `frontend/src/components/CpuSchedulingView.tsx`)
- Memory workspace → API client: requests results (evidence: `frontend/src/components/MemoryManagementView.tsx`)
- Paging workspace → API client: requests results (evidence: `frontend/src/components/PageReplacementView.tsx`)
- CPU workspace → Playback graph: renders (evidence: `frontend/src/components/CpuSchedulingView.tsx`)
- CPU workspace → Theory and proofs: renders (evidence: `frontend/src/components/CpuSchedulingView.tsx`)
- Memory workspace → Playback graph: renders (evidence: `frontend/src/components/MemoryManagementView.tsx`)
- Memory workspace → Theory and proofs: renders (evidence: `frontend/src/components/MemoryManagementView.tsx`)
- Paging workspace → Frame playback graph: renders (evidence: `frontend/src/components/PageReplacementView.tsx`)
- Paging workspace → Theory and proofs: renders (evidence: `frontend/src/components/PageReplacementView.tsx`)
- API client → Simulator types: uses types (evidence: `frontend/src/api/client.ts`)
- API client → REST API routes: sends requests (evidence: `frontend/src/api/client.ts`)
- Server entrypoint → REST API routes: starts (evidence: `backend/main.cpp`)
- REST API routes → Request validation: validates inputs (evidence: `backend/server/api.cpp`)
- REST API routes → Scheduling engine: dispatches scheduling (evidence: `backend/server/api.cpp`)
- REST API routes → Page replacement engine: dispatches paging (evidence: `backend/server/api.cpp`)
- REST API routes → Partition allocator: dispatches allocation
- REST API routes → Memory session state: maintains session (evidence: `backend/server/api.cpp`)
- API client → REST API routes: calls API routes (evidence: `README.md`)
