Skip to content

I’ve never thought philosophy would be so deadly. In this project, I learned the basics of threading a process and mutexes.

Notifications You must be signed in to change notification settings

tzeck1/philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Philosophers

I’ve never thought philosophy would be so deadly.
In this project, I learned the basics of threading a process and mutexes.

Here you can read more about the problem https://en.wikipedia.org/wiki/Dining_philosophers_problem

Screenshot 2022-03-27 at 20 34 58

Introduction

- philo number: how many philosophers are sitting at the table
- time to die: time in milliseconds until a philo dies after his last meal
- time to eat: time in milliseconds it takes a philo to eat
- time to die: time in milliseconds it takes a philo to sleep
- number must eat: how many times a philo must at least have eaten to end the simulation

A philosopher has to announce its current status in the STDOUT, which can be:

  • philo n has taken a fork
  • philo n is eating
  • philo n is sleeping
  • philo n is thinking
  • philo n died

Usage

make to compile all source files
./philo <philo number> <time to die> <time to eat> <time to sleep> <number must eat> to start the simulation

About

I’ve never thought philosophy would be so deadly. In this project, I learned the basics of threading a process and mutexes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published