ayogun / philosophers

Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system, which is traditionally commonly introduced in lectures on operating systems. Here, I solved the classic philosophers problem with C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

42-philosophers

Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system, which is traditionally commonly introduced in lectures on operating systems

Subject is presented in the en.subject.pdf

For example, N philosophers are sitting at a round table and eating. A fork is placed between the philosophers, and the philosophers eat through the following process.

The philosopher repeats three actions:
eating ➔ sleeping ➔ thinking. When eating, both forks should be used. If you lift both forks, eat for a certain amount of time. When you're done eating, put down your fork. Not a single philosopher should die due to lack of food for a certain period of time. If all the philosophers were hungry and picked up the left forks at the same time, the right forks would have already been picked up by the philosopher sitting to their right, and everyone would be forever unable to hold the right forks. That is, there is no further progress, and the philosophers remain on standby forever. This phenomenon is called deadlock. Once in a deadlock, philosophers continue to suffer and die of starvation. The task is to implement a program that solves this problem using mutex or semaphore


About

Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system, which is traditionally commonly introduced in lectures on operating systems. Here, I solved the classic philosophers problem with C

License:MIT License


Languages

Language:C 89.7%Language:Makefile 10.3%