Philosophers
Threads, in perfect harmony.

The Dining Philosophers problem in C: philosophers as threads, forks as mutexes, and no deadlocks or data races.
The problem
Several threads share limited resources. Without care, they deadlock or starve. The classic Dining Philosophers problem makes the danger concrete.
How I built it
- 01Each philosopher runs in its own thread and each fork is a mutex.
- 02The simulation stops cleanly as soon as a philosopher starves.
- 03Shared state such as logs and meal counts is protected so output never interleaves.
Key takeaways
- — Deadlocks, race conditions and how to avoid them.
- — pthread_create, pthread_join versus detach, and mutex lifecycles.
Philosophers was built as part of the software engineering curriculum at 1337 Coding School (42 Network, UM6P), where every project is built from scratch and reviewed by peers.