How leobisk/practica-gestion-concurrente works
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 Simulation runner · datos.py Stock and workload data
Components 13
Runtime coordination
- Simulation runner
gestor.py - Stock and workload data
datos.py - Shared order list
gestor.py - Checkout workers
gestor.py - Terminal semaphore
gestor.py
Inventory operations
- Inventory manager
gestor.py - Restock worker
gestor.py - Shared inventory
gestor.py - Stock condition
gestor.py
Inventory review
- Review workers
gestor.py - Review barrier
gestor.py - Review summary
gestor.py
Other components
- Operator
Connections 18
- Operator → Simulation runner: runs
README.md - Simulation runner → Stock and workload data: loads
gestor.py - Simulation runner → Restock worker: starts
gestor.py - Simulation runner → Checkout workers: starts
gestor.py - Simulation runner → Review workers: starts after checkout
gestor.py - Simulation runner → Review summary: prints
gestor.py - Stock and workload data → Inventory manager: initializes
gestor.py - Stock and workload data → Shared order list: provides orders
gestor.py - Checkout workers → Shared order list: pops orders
gestor.py - Checkout workers → Terminal semaphore: acquires
gestor.py - Checkout workers → Inventory manager: sells items
gestor.py - Inventory manager → Shared inventory: reads and updates
gestor.py - Restock worker → Inventory manager: calls restock
gestor.py - Inventory manager → Stock condition: waits and notifies
gestor.py - Restock worker → Stock and workload data: uses replenishments
gestor.py - Review workers → Review barrier: waits
gestor.py - Review workers → Shared inventory: reads stock
gestor.py - Review workers → Review summary: records values
gestor.py