MGuardia10 / 42cursus_philosophers

philosophers with threads and mutex.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

42cursus_philosophers

The mandatory part of this project asks us to solve the dining philosophers problem and implement a mutithreading solution using mutexes.

C LINUX

You can see the subject HERE.

To visualize the output copy the actions made by the philosophers HERE.

Installing and running the project:

1- Clone this repository

git clone https://github.com/MGuardia10/42cursus_philosophers.git

2- Navigate to the new directory and run make

cd 42cursus_philosophers
make

3- make clean to remove the object files and work on a cleaner directory

make clean

4- Start the simulation using the correct arguments:

./philo <number_philos> <time_to_die> <time_to_eat> <time_to_sleep> [number_of_meals]

Compiling the Program

The philo program comes with a Makefile that includes the following rules:

  • all: compiles the program.
  • re: recompiles the program.
  • clean: removes obj directory with objects files.
  • fclean: removes obj directory with objects files and philo binary.

Disclaimer

At 42School, 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.

About

philosophers with threads and mutex.


Languages

Language:C 96.8%Language:Makefile 3.2%