https://github.com/taisiabarteneva/philosophers
A solution to dining philosophers problem
https://github.com/taisiabarteneva/philosophers
c dining-philosophers-problem djikstra-algorithm multiprocessing multithreading
Last synced: 8 months ago
JSON representation
A solution to dining philosophers problem
- Host: GitHub
- URL: https://github.com/taisiabarteneva/philosophers
- Owner: taisiabarteneva
- Created: 2022-01-26T19:02:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-10T14:54:14.000Z (over 3 years ago)
- Last Synced: 2025-01-11T12:26:01.934Z (9 months ago)
- Topics: c, dining-philosophers-problem, djikstra-algorithm, multiprocessing, multithreading
- Language: C
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 42-philosophers
A solution to dining philosophers problem using threads and mutexes. It is one of the classic problems used to describe synchronization issues in a multithreading program.## What have I learned
- Threads
- Synchronization primitives such as mutex and semaphoreI decided to implement an algorithm formulated by Dijkstra due to its simplicity and elegance.
A program takes following arguments:
- number_of_philosophers
- time_to_die (in milliseconds)
- time_to_eat (in milliseconds)
- time_to_sleep (in milliseconds) (optional)## How to build
```
$> make
```
## How to launch
Run with you parameters, e.g. :
```
$> ./philo 5 800 200 200 7
```