I never thought philosophy would become so lethal
In this project, you will learn the basic principles of threading a process. You will learn how to create threads and discover mutex.
For more detailed information, look at the subject of this project.
The function is written in C language and thus needs the gcc
compiler and some standard C libraries to run.
1. Compiling
To compile, go to the project path and run:
$ make
To execute the program, run:
$ ./philo <number_of_philosophers> <time_to_die time_to_eat> <time_to_sleep> [number_of_times_each_philosopher_must_eat]
An example with 4 philosophers, 410 ms to die, 200 ms to eat and 200 ms to sleep:
$ ./philo 4 410 200 200
In this case no one dies, but if we put 310 ms to die instead:
$ ./philo 4 310 200 200
There will be a moment where one of them will die because the time elapsed since the last meal exceeded the time to die.