# lortizrios/operatingsystemsimulation architecture

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

- Interactive diagram: https://gitdiagram.com/lortizrios/operatingsystemsimulation
- Repository: https://github.com/lortizrios/operatingsystemsimulation

## Overview

##### Project type and purpose
- This is a standalone Java application that simulates core operating-system behavior (process life cycle, CPU scheduling, process control blocks, etc.).
- Key indicators:
- Class names: CPU.java, Process.java, PCBTableModel.java, RandomProcessGenerator.java
- UI form: Panel.form and Panel.java
- Entry point: OS_Simulator.java
- README describes it as an “Operating System Simulation in Java.”

##### File structure
- Top-level files:
- OS_Simulator.java – likely the main controller or entry point.
- CPU.java – encapsulates CPU state and scheduling logic.
- Process.java – models a single process (its attributes, state).
- RandomProcessGenerator.java – produces new Process instances at runtime.
- PCBTableModel.java – a Swing TableModel that holds the list of PCBs for the GUI table.
- Panel.form / Panel.java – the Swing UI components and layout.
- Pattern:
- MVC-style separation
– Model: Process, PCBTableModel
– View: Panel (Swing form)
– Controller/Engine: OS_Simulator + CPU + RandomProcessGenerator

##### README for additional insights
- Minimal but confirms Java and OS-simulation focus.
- No external dependencies or services indicated—everything runs in-process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface"
        Panel["Panel (Swing UI)"]:::ui
    end

    %% Simulation Engine Layer
    subgraph "Simulation Engine"
        OS["OS_Simulator"]:::engine
        CPU["CPU"]:::engine
        RPG["RandomProcessGenerator"]:::engine
    end

    %% Data Model Layer
    subgraph "Data Model"
        PCB["PCBTableModel"]:::data
    end

    %% Entities Layer
    subgraph "Entities"
        Proc["Process"]:::entity
    end

    %% Connections
    Panel -->|"start/pause/step"| OS
    OS -->|"generateProcess()"| RPG
    RPG -->|"new Process()"| Proc
    Proc -->|"register()"| PCB
    OS -->|"scheduleNext()"| CPU
    CPU -->|"updateState()"| PCB
    PCB -->|"fireTableRowsInserted()"| Panel

    %% Click Events
    click Panel "https://github.com/lortizrios/operatingsystemsimulation/blob/main/Panel.java"
    click Panel "https://github.com/lortizrios/operatingsystemsimulation/blob/main/Panel.form"
    click OS "https://github.com/lortizrios/operatingsystemsimulation/blob/main/OS_Simulator.java"
    click CPU "https://github.com/lortizrios/operatingsystemsimulation/blob/main/CPU.java"
    click RPG "https://github.com/lortizrios/operatingsystemsimulation/blob/main/RandomProcessGenerator.java"
    click PCB "https://github.com/lortizrios/operatingsystemsimulation/blob/main/PCBTableModel.java"
    click Proc "https://github.com/lortizrios/operatingsystemsimulation/blob/main/Process.java"

    %% Styles
    classDef ui fill:#add8e6,stroke:#333,stroke-width:1px
    classDef engine fill:#90ee90,stroke:#333,stroke-width:1px
    classDef data fill:#ffffe0,stroke:#333,stroke-width:1px
    classDef entity fill:#ffa500,stroke:#333,stroke-width:1px
```
