# leobisk/practica-gestion-concurrente architecture

> Architecture diagram of the GitHub repository leobisk/practica-gestion-concurrente, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leobisk/practica-gestion-concurrente
- Repository: https://github.com/leobisk/practica-gestion-concurrente

## Overview

StockFlow is a Python threaded inventory and order simulation. Running `gestor.py` starts a delayed restock, concurrent checkout workers that consume shared orders, and—after the workers finish—a barrier-coordinated inventory review whose collected values are printed. `datos.py` supplies the stock, orders, replenishments, and concurrency limits. The graph reflects the sampled implementation; the review reads inventory without taking the inventory lock, and the barrier coordinates reviewers rather than checkout workers.

Main entry points: [`gestor.py`](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py) (Simulation runner), [`datos.py`](https://github.com/leobisk/practica-gestion-concurrente/blob/main/datos.py) (Stock and workload data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime coordination"]
  node_runner["Simulation runner<br/>[gestor.py]"]
  node_datasets[("Stock and workload data<br/>[datos.py]")]
  node_order_pool[("Shared order list<br/>[gestor.py]")]
  node_checkout_workers["Checkout workers<br/>[gestor.py]"]
  node_checkout_limit["Terminal semaphore<br/>[gestor.py]"]
end

subgraph group_inventory["Inventory operations"]
  node_inventory_manager["Inventory manager<br/>[gestor.py]"]
  node_restock_worker["Restock worker<br/>[gestor.py]"]
  node_inventory_state[("Shared inventory<br/>[gestor.py]")]
  node_stock_condition["Stock condition<br/>[gestor.py]"]
end

subgraph group_review["Inventory review"]
  node_reviewers["Review workers<br/>[gestor.py]"]
  node_review_barrier["Review barrier<br/>[gestor.py]"]
  node_review_summary[("Review summary<br/>[gestor.py]")]
end

node_operator(("Operator"))

node_operator -->|"runs"| node_runner
node_runner -->|"loads"| node_datasets
node_runner -->|"starts"| node_restock_worker
node_runner -->|"starts"| node_checkout_workers
node_runner -->|"starts after checkout"| node_reviewers
node_runner -->|"prints"| node_review_summary
node_datasets -->|"initializes"| node_inventory_manager
node_datasets -->|"provides orders"| node_order_pool
node_checkout_workers -->|"pops orders"| node_order_pool
node_checkout_workers -->|"acquires"| node_checkout_limit
node_checkout_workers -->|"sells items"| node_inventory_manager
node_inventory_manager -->|"reads and updates"| node_inventory_state
node_restock_worker -->|"calls restock"| node_inventory_manager
node_inventory_manager -->|"waits and notifies"| node_stock_condition
node_restock_worker -->|"uses replenishments"| node_datasets
node_reviewers -->|"waits"| node_review_barrier
node_reviewers -->|"reads stock"| node_inventory_state
node_reviewers -->|"records values"| node_review_summary

click node_runner "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_datasets "https://github.com/leobisk/practica-gestion-concurrente/blob/main/datos.py"
click node_order_pool "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_checkout_workers "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_checkout_limit "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_inventory_manager "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_restock_worker "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_inventory_state "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_stock_condition "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_reviewers "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_review_barrier "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py"
click node_review_summary "https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.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_runner,node_datasets,node_order_pool,node_checkout_workers,node_checkout_limit toneBlue
class node_inventory_manager,node_restock_worker,node_inventory_state,node_stock_condition toneAmber
class node_reviewers,node_review_barrier,node_review_summary toneMint
class node_operator toneIndigo
```

## Components

### Runtime coordination

- [Simulation runner](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Stock and workload data](https://github.com/leobisk/practica-gestion-concurrente/blob/main/datos.py): `datos.py`
- [Shared order list](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Checkout workers](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Terminal semaphore](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`

### Inventory operations

- [Inventory manager](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Restock worker](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Shared inventory](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Stock condition](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`

### Inventory review

- [Review workers](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Review barrier](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`
- [Review summary](https://github.com/leobisk/practica-gestion-concurrente/blob/main/gestor.py): `gestor.py`

### Other components

- **Operator**

## Connections

- Operator → Simulation runner: runs (evidence: `README.md`)
- Simulation runner → Stock and workload data: loads (evidence: `gestor.py`)
- Simulation runner → Restock worker: starts (evidence: `gestor.py`)
- Simulation runner → Checkout workers: starts (evidence: `gestor.py`)
- Simulation runner → Review workers: starts after checkout (evidence: `gestor.py`)
- Simulation runner → Review summary: prints (evidence: `gestor.py`)
- Stock and workload data → Inventory manager: initializes (evidence: `gestor.py`)
- Stock and workload data → Shared order list: provides orders (evidence: `gestor.py`)
- Checkout workers → Shared order list: pops orders (evidence: `gestor.py`)
- Checkout workers → Terminal semaphore: acquires (evidence: `gestor.py`)
- Checkout workers → Inventory manager: sells items (evidence: `gestor.py`)
- Inventory manager → Shared inventory: reads and updates (evidence: `gestor.py`)
- Restock worker → Inventory manager: calls restock (evidence: `gestor.py`)
- Inventory manager → Stock condition: waits and notifies (evidence: `gestor.py`)
- Restock worker → Stock and workload data: uses replenishments (evidence: `gestor.py`)
- Review workers → Review barrier: waits (evidence: `gestor.py`)
- Review workers → Shared inventory: reads stock (evidence: `gestor.py`)
- Review workers → Review summary: records values (evidence: `gestor.py`)
