An open API service indexing awesome lists of open source software.

https://github.com/jenkinsdev/diningphilosophers

Solution for the classic concurrency problem, dining philosophers.
https://github.com/jenkinsdev/diningphilosophers

Last synced: over 1 year ago
JSON representation

Solution for the classic concurrency problem, dining philosophers.

Awesome Lists containing this project

README

          

## The "Problem"

> In ancient times, a wealthy philanthropist endowed a College to accommodate five eminent philosophers. Each philosopher had a room in which they could engage in their professional activity of thinking; there was also a common dining room, furnished with a circular table, surrounded by five chairs, each labelled by the name of the philosopher who was to sit in it.

> They sat anticlockwise around the table. To the left of each philosopher there was laid a golden fork, and in the centre stood a large bowl of spaghetti, which was constantly replenished. A philosopher was expected to spend most of their time thinking; but when they felt hungry, they went to the dining room, sat down in their own chair, picked up their own fork on their left, and plunged it into the spaghetti. But such is the tangled nature of spaghetti that a second fork is required to carry it to the mouth. The philosopher therefore had also to pick up the fork on their right. When they were finished they would put down both their forks, get up from their chair, and continue thinking. Of course, a fork can be used by only one philosopher at a time. If the other philosopher wants it, they just have to wait until the fork is available again.
>
> --- Tony Hoare in 1985 ([Book](http://www.usingcsp.com/cspbook.pdf))