How gqtien/codexion works
Codexion is a pthread-based Dining Philosophers simulation: a user supplies coder counts, timing limits, compile goals, dongle cooldown, and a FIFO or EDF policy; the program runs coder threads that acquire two dongles, compile, debug, and refactor until all finish or a coder burns out. A monitor detects burnout/completion and wakes blocked workers for shutdown. The graph also shows request queues, initialization, and cleanup. Relationships are limited to the excerpts and README; unsampled implementation details are represented only where their paths are supported.
Main entry points: main.c Simulation entry · coder_routine.c Coder routine · monitor.c Burnout monitor · acquire_dongle.c Dongle acquisition
Components 15
Simulation control
- Argument parsing
src/parsing/parse_args.c - Simulation entry
src/main.c - State initialization
src/init - Burnout monitor
src/threads/monitor.c
Coder work
- Coder routine
src/threads/coder_routine.c
Dongle coordination
- Dongle ordering
src/dongles/dongle_order.c - Dongle acquisition
src/dongles/acquire_dongle.c - Wait queue
src/queue/queue.c - FIFO / EDF policy
src/queue/scheduler.c - Dongle release
src/dongles/release_dongle.c
Shared runtime
- Simulation state
includes/struct.h - Synchronized logging
src/utils/log.c - Time utilities
src/utils/time.c - Resource cleanup
src/utils/cleanup.c
Other components
- CLI user
Connections 18
- CLI user → Argument parsing: supplies settings
README.md - Argument parsing → Simulation entry: configures
src/main.c - Simulation entry → State initialization: initializes
src/main.c - Simulation entry → Coder routine: starts and joins
src/main.c - Simulation entry → Burnout monitor: starts and joins
src/main.c - Simulation entry → Resource cleanup: cleans up
src/main.c - Coder routine → Dongle acquisition: acquires
src/threads/coder_routine.c - Coder routine → Dongle release: releases
src/threads/coder_routine.c - Dongle acquisition → Dongle ordering: gets order
README.md - Dongle acquisition → Wait queue: queues requests
src/dongles/acquire_dongle.c - State initialization → FIFO / EDF policy: selects policy
src/init/init_dongles.c - Burnout monitor → Simulation entry: wakes waiters
src/threads/monitor.c - Burnout monitor → Simulation state: checks coder state
src/threads/monitor.c - Coder routine → Synchronized logging: logs stages
src/threads/coder_routine.c - Coder routine → Time utilities: waits between stages
src/threads/coder_routine.c - Burnout monitor → Synchronized logging: logs burnout
src/threads/monitor.c - Dongle acquisition → Time utilities: checks cooldown
src/dongles/acquire_dongle.c - Dongle release → Wait queue: wakes queued coders
README.md