# locdt0190-svg/vme13_pagereplacement_nhom1 architecture

> Architecture diagram of the GitHub repository locdt0190-svg/vme13_pagereplacement_nhom1, 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/locdt0190-svg/vme13_pagereplacement_nhom1
- Repository: https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1

## Overview

This is a Tkinter page-replacement simulator. The user loads a CSV containing frame count and page references, selects FIFO, LRU, OPT, or Second-Chance, then steps through or runs the simulation and can export its trace as CSV. The GUI owns input handling, algorithm dispatch, progress, and output; the algorithm module returns per-step frames, hit/fault status, victims, and a fault count. The source shows LRU and Second-Chance currently delegate to FIFO. Relationships are limited to those visible in the excerpts and README.

Main entry points: [`source/main.py`](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py) (Algorithm dispatch), [`source/algorithms.py`](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/algorithms.py) (Replacement algorithms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["GUI and workflow<br/>[main.py]"]
  node_stepper["Step and run controls<br/>[main.py]"]
  node_visualizer["RAM and trace display<br/>[main.py]"]
end

subgraph group_simulation["Simulation"]
  node_selector["Algorithm dispatch<br/>[main.py]"]
  node_algorithms["Replacement algorithms<br/>[algorithms.py]"]
end

subgraph group_data["CSV data"]
  node_loader["CSV loader<br/>[main.py]"]
  node_exporter["CSV exporter<br/>[main.py]"]
end

node_user(("User"))
node_input_csv["Input CSV"]
node_output_csv["Output CSV"]

node_user -->|"runs"| node_app
node_user -->|"chooses file"| node_loader
node_input_csv -->|"reads"| node_loader
node_loader -->|"sets inputs"| node_selector
node_selector -->|"dispatches to"| node_algorithms
node_user -->|"selects controls"| node_stepper
node_stepper -->|"renders step"| node_visualizer
node_user -->|"requests export"| node_exporter
node_exporter -->|"writes"| node_output_csv
node_selector -->|"resets display"| node_visualizer

click node_app "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py"
click node_loader "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py"
click node_selector "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py"
click node_algorithms "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/algorithms.py"
click node_stepper "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py"
click node_visualizer "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py"
click node_exporter "https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.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_app,node_stepper,node_visualizer,node_user toneBlue
class node_selector,node_algorithms toneAmber
class node_loader,node_exporter toneMint
class node_input_csv,node_output_csv toneIndigo
```

## Components

### User interface

- [GUI and workflow](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`
- [Step and run controls](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`
- [RAM and trace display](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`

### Simulation

- [Algorithm dispatch](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`
- [Replacement algorithms](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/algorithms.py): `source/algorithms.py`

### CSV data

- [CSV loader](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`
- [CSV exporter](https://github.com/locdt0190-svg/vme13_pagereplacement_nhom1/blob/main/source/main.py): `source/main.py`

### Other components

- **User**
- **Input CSV**
- **Output CSV**

## Connections

- User → GUI and workflow: runs (evidence: `README.md`)
- User → CSV loader: chooses file (evidence: `source/main.py`)
- Input CSV → CSV loader: reads (evidence: `source/main.py`)
- CSV loader → Algorithm dispatch: sets inputs (evidence: `source/main.py`)
- Algorithm dispatch → Replacement algorithms: dispatches to (evidence: `source/main.py`)
- User → Step and run controls: selects controls (evidence: `source/main.py`)
- Step and run controls → RAM and trace display: renders step (evidence: `source/main.py`)
- User → CSV exporter: requests export (evidence: `source/main.py`)
- CSV exporter → Output CSV: writes (evidence: `source/main.py`)
- Algorithm dispatch → RAM and trace display: resets display (evidence: `source/main.py`)
