# maxitoto/integradorso architecture

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

- Interactive diagram: https://gitdiagram.com/maxitoto/integradorso
- Repository: https://github.com/maxitoto/integradorso

## Overview

##### Project Type and Purpose
- This is a Java-based CPU scheduling simulator organized with an MVC structure.
- It reads a list of processes (procesos.txt), applies different scheduling policies (FCFS, Round Robin, SPN, etc.), updates process state over time, and writes out results in the Resultados directory.

##### High-Level Architecture Components
a. User Interface Layer (View)
- View/InicioView.java – main GUI window for loading processes, selecting policy, starting/stopping simulation
- View/ControllerErroresView.java – dialog for showing errors or logs
b. Controller Layer
- Controller/inicioController.java – mediates user events (button clicks) → starts/stops simulation → updates View
- Controller/ControllerErroresView.java – handles error logging and display
c. Simulation Engine
- Simulador/iniciador.java – contains main(String[]), bootstraps So (Sistema Operativo) instance, kicks off the scheduling loop
- So.java (Model) – core orchestrator: holds references to ready/blocked queues, CPU instance, current policy, drives time ticks
d. Domain Model (Model)
- Process representation
– Proceso.java – data structure for a process (ID, burst time, priority, etc.)
– Estados (Nuevo, Listo, Ejecutando, Bloqueado, Terminado) – State Pattern: each state implements Estado interface
- Scheduling Policies (Strategy Pattern)
– Politica.java – interface for selecting next process
– FCFS.java, RoundRobin.java, SPN.java, SRTN.java, PrioridadExterna.java – concrete implementations
- CPU.java – simulates CPU time slice, executes the current Proceso
e. Persistence & Artifacts
- Resultados/*.txt – output logs per policy
- procesos.txt – sample input
- TPI-TomasBlanco.jar – compiled simulator JAR
f. Documentation & UML
- “Políticas de Planificación…” PDF – design paper

##### Interactions & Data Flow
1) User triggers “Start” in InicioView → calls inicioController.startSimulation()
2) Controller loads procesos.txt → builds Proceso objects → passes to So instance
3) So loops:
– Queries current Politica for next Proceso
– Moves Proceso through Estados (State transitions)
– Delegates to CPU.execute() for time slice
– Writes intermediate state to log (in-memory or file)
4) Controller polls So for status updates → updates View with Gantt chart or table
5) On completion, So writes final timeline to Resultados/<policy>.txt → View notifies user

##### Key Architectural Patterns
- MVC (View <> Controller <> Model)
- Strategy Pattern for scheduling policies (Politica + implementations)
- State Pattern for process life-cycle (Estados hierarchy)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "UI Layer"
        IV["InicioView"] 
    end
    class IV ui;

    subgraph "Controller Layer"
        IC["inicioController"]
        CEV["ControllerErroresView"]
    end
    class IC,CEV controller;

    subgraph "Simulation Engine"
        INI["iniciador"]
        SO["So"]
    end
    class INI,SO engine;

    subgraph "Domain Model"
        subgraph "Process Model"
            P["Proceso"]
            CPU["Cpu"]
            AUD["Auditor"]
        end
        subgraph "State Pattern"
            EST["Estados"]
            N["Nuevo"]
            L["Listo"]
            E["Ejecutando"]
            B["Bloqueado"]
            T["Terminado"]
        end
        subgraph "Strategy Pattern"
            POL["Politica"]
            F["FCFS"]
            RR["RoundRobin"]
            SPN["SPN"]
            SRTN["SRTN"]
            PE["PrioridadExterna"]
        end
    end
    class P,CPU,AUD,EST,N,L,E,B,T,POL,F,RR,SPN,SRTN,PE domain;

    subgraph "Persistence & Artifacts"
        INP["procesos.txt"]
        JAR["TPI-TomasBlanco.jar"]
        RES["Resultados/"]
        DP["Políticas de Planificación…pdf"]
        UMLS["UMLs/"]
    end
    class INP,JAR,RES,DP,UMLS persistence;

    IV -->|"startSimulation()"| IC
    IC -->|"loadProcesses()"| INP
    INP -->|"return data"| IC
    IC -->|"bootstrap()"| INI
    INI -->|"init So"| SO
    SO -->|"nextProcess()"| POL
    POL -->|"select process"| F
    POL -->|"select process"| RR
    POL -->|"select process"| SPN
    POL -->|"select process"| SRTN
    POL -->|"select process"| PE
    SO -->|"execute()"| CPU
    CPU -->|"done"| SO
    SO -->|"log()"| AUD
    SO -->|"writeFinal()"| RES
    SO -->|"statusUpdate()"| IC
    IC -->|"updateView()"| IV

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef controller fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef engine fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef domain fill:#FFFF99,stroke:#000,stroke-width:1px;
    classDef persistence fill:#D3D3D3,stroke:#000,stroke-width:1px;

    click IV "https://github.com/maxitoto/integradorso/blob/main/View/InicioView.java"
    click IC "https://github.com/maxitoto/integradorso/blob/main/Controller/inicioController.java"
    click CEV "https://github.com/maxitoto/integradorso/blob/main/Controller/ControllerErroresView.java"
    click INI "https://github.com/maxitoto/integradorso/blob/main/Simulador/iniciador.java"
    click SO "https://github.com/maxitoto/integradorso/blob/main/Model/So.java"
    click P "https://github.com/maxitoto/integradorso/blob/main/Model/Proceso.java"
    click EST "https://github.com/maxitoto/integradorso/blob/main/Model/Estados.java"
    click N "https://github.com/maxitoto/integradorso/blob/main/Model/Nuevo.java"
    click L "https://github.com/maxitoto/integradorso/blob/main/Model/Listo.java"
    click E "https://github.com/maxitoto/integradorso/blob/main/Model/Ejecutando.java"
    click B "https://github.com/maxitoto/integradorso/blob/main/Model/Bloqueado.java"
    click T "https://github.com/maxitoto/integradorso/blob/main/Model/Terminado.java"
    click POL "https://github.com/maxitoto/integradorso/blob/main/Model/Politica.java"
    click F "https://github.com/maxitoto/integradorso/blob/main/Model/FCFS.java"
    click RR "https://github.com/maxitoto/integradorso/blob/main/Model/RoundRobin.java"
    click SPN "https://github.com/maxitoto/integradorso/blob/main/Model/SPN.java"
    click SRTN "https://github.com/maxitoto/integradorso/blob/main/Model/SRTN.java"
    click PE "https://github.com/maxitoto/integradorso/blob/main/Model/PrioridadExterna.java"
    click CPU "https://github.com/maxitoto/integradorso/blob/main/Model/Cpu.java"
    click AUD "https://github.com/maxitoto/integradorso/blob/main/Model/Auditor.java"
    click INP "https://github.com/maxitoto/integradorso/blob/main/procesos.txt"
    click JAR "https://github.com/maxitoto/integradorso/blob/main/TPI-TomasBlanco.jar"
    click RES "https://github.com/maxitoto/integradorso/tree/main/Resultados/"
    click DP "https://github.com/maxitoto/integradorso/blob/main/Políticas de Planificación de Procesos - Tomas Blanco - Sistemas Operativos.pdf"
    click UMLS "https://github.com/maxitoto/integradorso/tree/main/UMLs/"
```
