Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.58 KB

README.md

File metadata and controls

49 lines (34 loc) · 1.58 KB

Philosophers [125 / 100]

Summary

The ninth project in the 42sp fundamentals track, Philosophers, is about to solve the the Dining Philosophers Problem, a famous problem in computer science used to illustrate common issues in concurrent programming. The main objective of this project is to introduce the use of Threads, Mutexes, Semaphores and Forks.


Run the Program

  • Make sure you clone the repository with the following command:
$> git clone [email protected]:ArthurSobreira/42_philosophers.git
  • Once cloned, to compile the program, use the following commands:
$> make / make bonus

The Project

  • To run either the mandatory or bonus part of the program, just call ./philo or ./philo_bonus passing the following arguments:
$> ./philo [number_of_philosophers] [time_to_die] [time_to_eat] [time_to_sleep] [times_each_philosopher_must_eat] (optional)
  • The program should display a log in the terminal with some information about each philo:
timestamp_in_ms X 🍽 has taken a fork
timestamp_in_ms X 🍝 is eating
timestamp_in_ms X 💤 is sleeping
timestamp_in_ms X 💡 is thinking
timestamp_in_ms X 💀 died