42 project to learn the basics of threads.
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. A variation on the philosophers dining problem. This is a school project and we were given some additional limits, e.g. the philosophers can't communicate with each other and the limited set of allowed external functions.
Allowed external functions:
memset, printf, malloc, free, write, usleep, gettimeofday, pthread_create, pthread_detach, pthread_join, pthread_mutex_init, pthread_mutex_destroy, pthread_mutex_lock, pthread_mutex_unlock
To create the executable:
cd philo
make
To run the program:
./philo [Number of philosophers] [time to die] [time to eat] [time to sleep] Optional: [Number of times each philosopher must eat]