# mahdeehaq/os-lab-project--memory_simulator architecture

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

- Interactive diagram: https://gitdiagram.com/mahdeehaq/os-lab-project--memory_simulator
- Repository: https://github.com/mahdeehaq/os-lab-project--memory_simulator

## Overview

This C++ memory-simulation project includes page-input helpers, a FIFO page-replacement implementation, a result data model, and a step-table printer. The intended workflow is to enter or load page references and a frame count, run replacement, then inspect hits, faults, and evictions. However, the sampled main function only prints a greeting: no shown code connects input, FIFO, and printing. The README names paging, replacement, and workload analysis, but the tree and excerpts support only FIFO; other algorithms or analysis stages are not represented here.

Main entry points: [`include/result.h`](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/include/result.h) (Simulation result), [`src/input.cpp`](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/input.cpp) (Input validation), [`src/fifo.cpp`](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/fifo.cpp) (FIFO replacement), [`src/print.cpp`](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/print.cpp) (Step-table output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Program entry"]
  node_main["Greeting entry<br/>[main.cpp]"]
end

subgraph group_input["Page input"]
  node_input_reader["Input validation<br/>[input.cpp]"]
end

subgraph group_simulation["FIFO simulation"]
  node_fifo["FIFO replacement<br/>[fifo.cpp]"]
end

subgraph group_reporting["Results and reporting"]
  node_result["Simulation result<br/>[result.h]"]
  node_printer["Step-table output<br/>[print.cpp]"]
end

node_keyboard(("Keyboard user"))
node_page_file["Page-reference file"]

node_keyboard -->|"enters values"| node_input_reader
node_page_file -->|"reads references"| node_input_reader
node_fifo -->|"returns result"| node_result
node_result -->|"reads steps"| node_printer

click node_main "https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/main.cpp"
click node_input_reader "https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/input.cpp"
click node_fifo "https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/fifo.cpp"
click node_result "https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/include/result.h"
click node_printer "https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/print.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_main,node_keyboard toneBlue
class node_input_reader toneAmber
class node_fifo toneMint
class node_result,node_printer toneRose
class node_page_file toneIndigo
```

## Components

### Program entry

- [Greeting entry](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/main.cpp): `src/main.cpp`

### Page input

- [Input validation](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/input.cpp): `src/input.cpp`

### FIFO simulation

- [FIFO replacement](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/fifo.cpp): `src/fifo.cpp`

### Results and reporting

- [Simulation result](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/include/result.h): `include/result.h`
- [Step-table output](https://github.com/mahdeehaq/os-lab-project--memory_simulator/blob/main/src/print.cpp): `src/print.cpp`

### Other components

- **Keyboard user**
- **Page-reference file**

## Connections

- Keyboard user → Input validation: enters values (evidence: `src/input.cpp`)
- Page-reference file → Input validation: reads references (evidence: `src/input.cpp`)
- FIFO replacement → Simulation result: returns result (evidence: `src/fifo.cpp`)
- Simulation result → Step-table output: reads steps (evidence: `src/print.cpp`)
