Cigarette smokers problem - Wikipedia, the free encyclopedia
Assume a cigarette requires three ingredients to make and smoke: tobacco, paper, and matches. There are three smokers around a table, each of whom has an infinite supply of one of the three ingredients — one smoker has an infinite supply of tobacco, another has paper, and the third has matches.
There is also a non-smoking agent who enables the smokers to make their cigarettes by arbitrarily (non-deterministically) selecting two of the supplies to place on the table. The smoker who has the third supply should remove the two items from the table, using them (along with their own supply) to make a cigarette, which they smoke for a while. Once the smoker has finished their cigarette, the agent places two new random items on the table. This process continues forever.
http://www.cs.loyola.edu/~jglenn/Lafayette/406/F2000/Notes/Smokers/Problem.java
https://paulamarcu.wordpress.com/2014/08/16/cigarette-smokers-problem/
AKKA Version:
https://code.google.com/p/cigarette-smokers-problem/source/browse/src/Main.java?r=4
Read full article from Cigarette smokers problem - Wikipedia, the free encyclopedia
Assume a cigarette requires three ingredients to make and smoke: tobacco, paper, and matches. There are three smokers around a table, each of whom has an infinite supply of one of the three ingredients — one smoker has an infinite supply of tobacco, another has paper, and the third has matches.
There is also a non-smoking agent who enables the smokers to make their cigarettes by arbitrarily (non-deterministically) selecting two of the supplies to place on the table. The smoker who has the third supply should remove the two items from the table, using them (along with their own supply) to make a cigarette, which they smoke for a while. Once the smoker has finished their cigarette, the agent places two new random items on the table. This process continues forever.
http://www.cs.loyola.edu/~jglenn/Lafayette/406/F2000/Notes/Smokers/Problem.java
https://paulamarcu.wordpress.com/2014/08/16/cigarette-smokers-problem/
AKKA Version:
https://code.google.com/p/cigarette-smokers-problem/source/browse/src/Main.java?r=4
Read full article from Cigarette smokers problem - Wikipedia, the free encyclopedia