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

julienhouyet/42-philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

philosophers

42-philosophers

Introduction

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.

At 42 School, almost every project must be written in accordance to the Norm, the school's coding standard. As a result, the implementation of certain parts may appear strange and for sure had room for improvement.

âš¡ Usage

To use this project, compile the project and run the program with the following arguments :

number_of_philosophers time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]

  • number_of_philosophers: The number of philosophers and also the number of forks.

  • time_to_die (in milliseconds): If a philosopher didn’t start eating time_to_die milliseconds since the beginning of their last meal or the beginning of the simulation, they die.

  • time_to_eat (in milliseconds): The time it takes for a philosopher to eat. During that time, they will need to hold two forks.

  • time_to_sleep (in milliseconds): The time a philosopher will spend sleeping.

  • number_of_times_each_philosopher_must_eat (optional argument): If all philosophers have eaten at least number_of_times_each_philosopher_must_eat times, the simulation stops. If not specified, the simulation stops when a philosopher dies.

Example :

$ ./philo 4 410 200 200

🔌 Installation

To install the project, clone this repository :

$ [email protected]:julienhouyet/42-philosophers.git

📦 Commands

To compile the project, run :

$ make

To re-compile the project :

$ make re

To wipes all object files :

$ make clean

To delete the project and all object files

$ make fclean

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published