# alnsaraujo/anahy3 architecture

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

- Interactive diagram: https://gitdiagram.com/alnsaraujo/anahy3
- Repository: https://github.com/alnsaraujo/anahy3

## Overview

##### Main Components
- Execution Engine – At the heart of the system is a virtual machine environment embodied by AnahyVM and VirtualProcessor classes. These components execute “jobs” on NUMA systems.
- Job Management Subsystem – Classes like AnahyJob, Job, and their corresponding Attributes suggest that the system encapsulates its work in “jobs” with detailed attributes. You might also include JobGraph and JobId where the dependency or sequencing (or even execution order) of jobs is considered.
- Memory and Resource Management – Within SRC/lib, utilities like AnahySmartHeap, AnahySmartStack, and a lockFreeList indicate that there is custom and possibly concurrent memory management aimed at efficiently handling resource allocation on NUMA systems.

##### Architectural Patterns and Design Principles
- Modularization – The clear separation between job definitions, execution via virtual processors, and the scheduling/management layer indicates a modular design.
- Manager/Worker and Experimentation – Highlight the usage of manager/worker patterns for load balancing and note that several modules appear to be experimental, allowing for comparative architectural performance.

- Hardware/NUMA Nodes (base layer)
- Core Execution Engine (AnahyVM, VirtualProcessor)
- Job and Task Management (Job, JobAttributes, JobGraph, JobId)
- Scheduling/Load Balancing (Manager, Worker, ManagerController, Daemon)
- Memory/Resource Management (AnahySmartHeap, AnahySmartStack, lockFreeList)
- Experimental Variants (Sandbox implementations such as ProActivesVPS, newApproach, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer (NUMA Nodes)"
        NUMA["NUMA Hardware"]:::hardware
    end

    %% Execution Engine
    subgraph "Execution Engine"
        AVM["AnahyVM (Execution Engine)"]:::engine
        VP["VirtualProcessor (Execution Core)"]:::engine
    end

    %% Job Management Subsystem
    subgraph "Job Management Subsystem"
        JOB["Job"]:::job
        JOBATTR["JobAttributes"]:::job
        JOBGRAPH["JobGraph"]:::job
        JOBID["JobId"]:::job
    end

    %% Memory and Resource Management
    subgraph "Memory/Resource Management"
        HEAP["SmartHeap"]:::memory
        STACK["SmartStack"]:::memory
        LOCKFREE["lockFreeList"]:::memory
    end

    %% Load Balancing / Scheduling
    subgraph "Load Balancing / Scheduling"
        MANAGER["Manager"]:::scheduling
        WORKER["Worker"]:::scheduling
        MANAGERCTRL["ManagerController"]:::scheduling
        DAEMON["Daemon"]:::scheduling
    end

    %% Experimental Variants
    subgraph "Experimental Variants"
        EXP_ANAHY["Sandbox: Anahy Variant"]:::experimental
        EXP_HEAP["Sandbox: Heap Variant"]:::experimental
        EXP_PRO["Sandbox: ProActivesVPS Variant"]:::experimental
        EXP_NEW["Sandbox: newApproach Variant"]:::experimental
    end

    %% Connections between layers
    NUMA -->|"memory access"| HEAP
    NUMA -->|"memory access"| STACK
    HEAP -->|"allocates memory for"| AVM
    STACK -->|"allocates memory for"| VP

    JOB -->|"submits tasks to"| AVM
    JOBATTR -->|"defines tasks for"| JOB
    JOBGRAPH -->|"orders tasks for"| JOB
    JOBID -->|"identifies"| JOB

    MANAGER -->|"dispatches load to"| VP
    WORKER -->|"executes jobs on"| VP
    MANAGERCTRL -->|"oversees"| MANAGER
    DAEMON -->|"monitors"| MANAGER

    %% Cross interactions
    JOB ---|"memory usage"| LOCKFREE
    LOCKFREE ---|"used by"| VP

    %% Experimental variants influence core components
    EXP_ANAHY ---|"experimental VM and Job implementations"| AVM
    EXP_HEAP ---|"alternative job/memory tests"| HEAP
    EXP_PRO ---|"variant processor and job model"| VP
    EXP_NEW ---|"alternative scheduling"| DAEMON

    %% Styles
    classDef hardware fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef engine fill:#98FB98,stroke:#2E8B57,stroke-width:2px;
    classDef job fill:#ADD8E6,stroke:#1E90FF,stroke-width:2px;
    classDef memory fill:#FFA07A,stroke:#FF6347,stroke-width:2px;
    classDef scheduling fill:#DDA0DD,stroke:#8A2BE2,stroke-width:2px;
    classDef experimental fill:#EEEEEE,stroke:#696969,stroke-width:2px;

    %% Click Events for Execution Engine
    click AVM "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyVM.cpp"
    click AVM "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyVM.h"
    click VP "https://github.com/alnsaraujo/anahy3/blob/master/SRC/VirtualProcessor.cpp"
    click VP "https://github.com/alnsaraujo/anahy3/blob/master/SRC/VirtualProcessor.h"

    %% Click Events for Job Management Subsystem
    click JOB "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyJob.cpp"
    click JOB "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyJob.h"
    click JOBATTR "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyJobAttributes.cpp"
    click JOBATTR "https://github.com/alnsaraujo/anahy3/blob/master/SRC/AnahyJobAttributes.h"
    click JOB "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/Job.cpp"
    click JOB "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/Job.h"
    click JOBATTR "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobAttributes.cpp"
    click JOBATTR "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobAttributes.h"
    click JOBGRAPH "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobGraph.cpp"
    click JOBGRAPH "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobGraph.h"
    click JOBID "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobId.cpp"
    click JOBID "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/JobId.h"

    %% Click Events for Memory Management
    click HEAP "https://github.com/alnsaraujo/anahy3/blob/master/SRC/lib/AnahySmartHeap.h"
    click STACK "https://github.com/alnsaraujo/anahy3/blob/master/SRC/lib/AnahySmartStack.h"
    click LOCKFREE "https://github.com/alnsaraujo/anahy3/blob/master/SRC/lib/lockFreeList.h"

    %% Click Events for Load Balancing / Scheduling
    click MANAGER "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/Manager.cpp"
    click MANAGER "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/Manager.h"
    click WORKER "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/Worker.cpp"
    click WORKER "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/Worker.h"
    click MANAGERCTRL "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/ManagerController.cpp"
    click MANAGERCTRL "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/manager_and_worker/ManagerController.h"
    click DAEMON "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/Daemon.cpp"
    click DAEMON "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/Anahy/Daemon.h"
    click DAEMON "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/newApproach/Daemon.cpp"
    click DAEMON "https://github.com/alnsaraujo/anahy3/blob/master/Sandbox/newApproach/Daemon.h"

    %% Click Events for Experimental Variants
    click EXP_ANAHY "https://github.com/alnsaraujo/anahy3/tree/master/Sandbox/Anahy"
    click EXP_HEAP "https://github.com/alnsaraujo/anahy3/tree/master/Sandbox/Heap"
    click EXP_PRO "https://github.com/alnsaraujo/anahy3/tree/master/Sandbox/ProActivesVPS"
    click EXP_NEW "https://github.com/alnsaraujo/anahy3/tree/master/Sandbox/newApproach"
```
