๐ Study Docs โ Codexion (42 Porto)¶
This folder contains study notes prepared before tackling Codexion, a POSIX-threads project modeled on the classic dining philosophers problem โ coders competing for shared USB dongles instead of philosophers competing for forks.
Each file below covers one concept needed to understand and defend the project.

๐๏ธ Topics¶
| File | Covers |
|---|---|
01-dining-philosophers.md |
The classic problem, Coffman's 4 conditions, deadlock vs starvation vs livelock, the N=1 edge case |
02-pthreads-sync.md |
pthread_mutex_t, pthread_cond_t, wait/signal/broadcast, critical sections |
03-scheduling-fifo-edf.md |
FIFO vs Earliest Deadline First scheduling, tie-breaking, real-time scheduling basics |
04-heap-priority-queue.md |
Binary min-heap implemented from scratch, insert/extract-min, use as a scheduler queue |
05-timing-precision.md |
gettimeofday() vs clock_gettime(), usleep() drift, timedwait vs wait, when a coder notices should_stop, hitting the 10ms burnout window |
06-concurrency-debugging.md |
Valgrind, Helgrind, ThreadSanitizer โ catching leaks, races, and deadlocks |
๐ฏ How this maps to Codexion¶
| Codexion concept | Study topic |
|---|---|
| Dongles = forks, coders = philosophers | 01 |
| Mutex per dongle, cond var for waiting queue | 02 |
scheduler argument (fifo / edf) |
03 |
| "You must implement a priority queue (heap)" | 04 |
| Burnout log within 10ms, monitor thread | 05 |
| Norm + no leaks + no races during defense | 06 |
โ Suggested study order¶
01โ understand why the problem is hard02โ learn the C tools to solve it03and04โ the two mandatory scheduling/data-structure requirements05โ the precision constraints that make testing tricky06โ how to verify your own solution before submitting