Skip to content

42 project to learn the basics of threading a process

Notifications You must be signed in to change notification settings

meerpeer/Philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 

Repository files navigation

Philosophers

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

How to Test

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]

About

42 project to learn the basics of threading a process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published