Skip to content

Eat, Sleep, Spaghetti, repeat. This project is about learning how threads work by precisely timing a group of philosophers on when to pick up forks and eat spaghetti without dying from hunger.

Notifications You must be signed in to change notification settings

deydoux/42cursus-Philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Philosophers

Eat, Sleep, Spaghetti, repeat. This project is about learning how threads work by precisely timing a group of philosophers on when to pick up forks and eat spaghetti without dying from hunger.

About the project

The Philosophers project challenges students to solve the Dining Philosophers problem, a classic synchronization and resource sharing challenge in computer science. The goal is to create a program that simulates philosophers dining together, where each philosopher needs two forks to eat, and must avoid deadlocks and starvation.

Visualization

Visualization of ./philo 21 700 200 300 7

Key requirements

  • Simulate philosophers dining at a round table with forks between them
  • Each philosopher must eat, sleep, and think in a specific order
  • No philosopher should die from starvation
  • Each fork can only be used by one philosopher at a time
  • Proper handling of shared resources using mutexes and threads
  • Accurate timing of actions using millisecond precision

Skills learned

  • Multi-threading programming
  • Mutex and semaphore usage
  • Resource sharing and synchronization
  • Deadlock prevention
  • Race condition handling
  • Performance optimization
  • Time management in concurrent programming

References

About

Eat, Sleep, Spaghetti, repeat. This project is about learning how threads work by precisely timing a group of philosophers on when to pick up forks and eat spaghetti without dying from hunger.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published