Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

🌐 Available in: English | Italiano

🍝 philosophers

Description

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.

Features

  • 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

Skills gained

  • Concurrency with pthreads, synchronization and race conditions
  • State modeling and timing
  • Modular, safe design (mutexes, cleanup, error handling)

Build

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