🌐 Available in: English | Italiano
Simulation of the Dining Philosophers Problem in C using threads and mutexes. Focus on concurrency management, deadlock avoidance, and timing control (eat, sleep, think) with state monitoring and graceful termination.
- One thread per philosopher, mutexes for forks
- Anti-deadlock strategies (ordering/alternation, staggered timings)
- Monitor detecting death (timeout without eating) or meals completion
- Synchronized, timestamped logging
- Concurrency with pthreads, synchronization and race conditions
- State modeling and timing
- Modular, safe design (mutexes, cleanup, error handling)
make
./philo <n_philos> <time_to_die> <time_to_eat> <time_to_sleep> [meals_optional]
Topics / Keywords
C, philosophers, pthreads, mutex, concurrency, deadlock, synchronization, 42school