codexion - README

codexion

C project · featured · pthreads, mutexes, scheduling

Multithreaded twist on the Dining Philosophers: coders compete for shared dongles, with FIFO/EDF scheduling.

The problem

Dining philosophers with coders: each coder is a thread that needs two shared USB dongles to compile, and burns out if it goes too long without compiling. A monitor must log a burnout within 10 ms.

What I built

The hard part

Missed wake-ups. A released dongle stays unavailable for a cooldown, so a broadcast on release can arrive before the dongle is usable again, and a coder that simply waits for the next signal sleeps forever. The fix was a timed wait with a deadline recomputed every loop, plus re-checking the condition on every wake-up instead of trusting the signal.

What it looks like

$ ./codexion 5 800 200 100 100 3 10 edf
1478 3 has taken a dongle
1478 3 is compiling
1683 3 is debugging
1788 3 is refactoring

Built with

More projects