Skip to content

ecole42-yoma/Philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Philosophers

I never thought philosophy would be so deadly

  • 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.
  • In this project, you will learn the basics of threading a process.
  • You will see how to create threads and you will discover mutexes.

Examples

Compile

make

Execute

./philo philo_num die_ms eat_ms sleep_ms [must_eat]

  • philo_num
    • The number of philosophers and also the number of forks.
  • die_ms
    • time of life
    • If a philosopher didn’t start eating die_ms milliseconds since the beginning of their last meal or the beginning of the simulation, they die.
  • eat_ms
    • time to eat
    • The time it takes for a philosopher to eat. During that time, they will need to hold two forks of left and right.
  • sleep_ms
    • time to sleep
    • The time a philosopher will spend sleeping.
  • must_eat
    • optional parameter
    • If all philosophers have eaten at least must_eat times, the simulation stops.
    • If not specified, the simulation stops when a philosopher dies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published