Simulation of Cigarette Smokers Problem

A concurrency problem in computer science


Consider a system with three smoker processes and one agent process. One of the smoker processes has paper, another has tobacco, and the third has matches. The agent places two of the ingredients on the table. The smoker who has the remaining ingredient then makes and smoke a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients, and the cycle repeats.

Wiki

Play


Smoker 1
Smoker 2
Smoker 3
Agent
Tabocco
Papers
Matches
Random numbers generated : 0 0
Smoker 0 smoking

Smoker 1 has tobacco

Smoker 2 has papers

Smoker 3 has matches

Agent supplies -