Skip to content

Contents of 42sp's Ninth Project - Solve the Dining Philosophers Problem Using Threads

Notifications You must be signed in to change notification settings

ArthurSobreira/42_philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

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 git@github.com: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

About

Contents of 42sp's Ninth Project - Solve the Dining Philosophers Problem Using Threads

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published