This is a team project. Each group should submit one copy to Blackboard. The submission should include
the following:
- The role and achievement of each member in the group.
- Source codes of the project in a compressed file.
- Project documentations (project structure, major data structure, thread structure, synchronization
structure, etc.) - Test results
- Screenshots of the project.
- Analysis of synchronization – how you synchronize multiple threads access shared data structures
- Analysis of deadlocks in your project – if it may happen and how you deal with the deadlocks.
Project requirements
Write a program in whatever programming language you would like to use to simulate the following
scenario.
10 gamers are playing an online game. All of them need to enter a room but only one gamer can be in the
room at any moment. A gamer cannot progress to the next step of game until the gamer collects 20 gold
coins in the room.
There are 20 miners adding gold coins to the room. Only one miner can enter and drop gold coins in the
room at any moment. One miner can leave at most 5 gold coins in the room each time.
Once a gamer collects the gold coin in the room, regardless how many are in the room and how
many coins the gamer collects, the gamer must leave the room. If the gamer has more than 20
gold coins already, the gamer can progress to the next step. Otherwise, the gamer needs to wait
to enter the room again to collect more gold coins.
A miner cannot enter the room without coin. At any moment, at most one gamer, and one miner,
can be in the room. A miner can enter the room even if nobody is in the room.
Please add additional policies and details to the above rules: for example, how a gamer waits
outside the room and be selected - in a queue, or randomly, or any other policy defined by your
team. You can also decide how many coins a miner bring to the room, a random number, or a
fixed number, etc.
For any missing details necessary for your design, please add the details discussed by your team.