# alvarojorgeg/examen-planificacion-cpu architecture

> Architecture diagram of the GitHub repository alvarojorgeg/examen-planificacion-cpu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alvarojorgeg/examen-planificacion-cpu
- Repository: https://github.com/alvarojorgeg/examen-planificacion-cpu

## Overview

##### Project type and purpose
- This is a self-contained, object-oriented Python CLI tool for simulating CPU scheduling algorithms (FCFS and Round Robin), persisting process data, generating a Gantt chart, and computing scheduling metrics.
- It is meant as an educational open-source exercise rather than a distributed or web-based application.

##### File structure
- Top-level:
- README.md, requirements.txt, pytest.ini
- src/ — core modules
- tests/ — automated unit tests
- src/ modules:
- main.py – command-line entry point
- proceso.py – Process class (domain entity)
- scheduler.py – implements FCFS and Round Robin
- repositorio.py – JSON/CSV persistence layer
- metrics.py – computes average response, turnaround, wait times
- tests/ mirror each core module with corresponding test_*.py files.

##### README for additional insights
- Confirms the domain (CPU scheduling), CLI usage, dependencies (Python ≥3.10, pytest), and features (Gantt chart generation, persistence formats).
- No external network services or databases—just file I/O.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    CLI["CLI Interface"]:::presentation
    click CLI "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/src/main.py"

    %% Core Engine (Domain Layer)
    subgraph "Core Engine (src/)"
        direction TB
        PROCESS["Process Manager"]:::domain
        click PROCESS "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/src/proceso.py"
        SCHED["Scheduler Module\n(FCFS & Round Robin)"]:::domain
        click SCHED "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/src/scheduler.py"
        GANTT["Gantt Chart Generator"]:::domain
        METRICS["Metrics Engine"]:::domain
        click METRICS "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/src/metrics.py"
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        direction TB
        REPO["Persistence Layer"]:::persistence
        click REPO "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/src/repositorio.py"
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        JSON["JSON File"]:::datastore
        CSV["CSV File"]:::datastore
    end

    %% Quality Assurance
    subgraph "Automated Tests"
        direction TB
        TEST_PRO["test_proceso.py"]:::test
        click TEST_PRO "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/tests/test_proceso.py"
        TEST_SCH["test_scheduler.py"]:::test
        click TEST_SCH "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/tests/test_scheduler.py"
        TEST_REP["test_repositorio.py"]:::test
        click TEST_REP "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/tests/test_repositorio.py"
        TEST_MET["test_metrics.py"]:::test
        click TEST_MET "https://github.com/alvarojorgeg/examen-planificacion-cpu/blob/main/tests/test_metrics.py"
    end

    %% Interactions
    CLI -->|"instantiate processes"| PROCESS
    CLI -->|"invoke scheduling"| SCHED
    CLI -->|"compute metrics"| METRICS
    CLI -->|"persist results"| REPO

    SCHED -->|"manage process state"| PROCESS
    SCHED -->|"emit timeline data"| GANTT
    SCHED -->|"provide results"| METRICS

    REPO -->|"write/read"| JSON
    REPO -->|"write/read"| CSV

    %% Tests relationships
    TEST_PRO --> PROCESS
    TEST_SCH --> SCHED
    TEST_REP --> REPO
    TEST_MET --> METRICS

    %% Styling
    classDef presentation fill:#D0E6FA,stroke:#036;
    classDef domain fill:#E2F0D9,stroke:#099;
    classDef persistence fill:#FCE5CD,stroke:#E36;
    classDef datastore fill:#F4CCCC,stroke:#A00,stroke-dasharray: 5 5;
    classDef test fill:#ECECEC,stroke:#999,stroke-dasharray: 2 2;
```
