The purpose of this lab is to provide you with some experiencing seeing how various synchronization primitives play out in practice. It will take the form of playing four versions of a simple competitive online game.
1 Getting with a group
In the lab, create groups of 3–5 people each. TAs should help you form appropriate groups.
You will then go through the four game variants together.
2 The Game
You’ll be presented with
- a dollar amount you are trying to reach. Each player has a different target amount, all within $20 of one another.
- a dollar amount that is
on the table
- a set of buttons for adding or removing money in increments of $1, $5, $10, and $20
Your goal is to reach your target dollar amount before anyone else you are playing with does so.
3 The Variants
Variant 1 (link) has atomic money moves and no other synchronization. It is possible (even likely) that other players’ plays will occur between you looking at the table and your play being acted on.
Variant 2 (link) uses locks to prevent plays if someone else has made a play between your looking and acting.
Variant 3 (link) places arriving players in a queue and only lets them play in order. It is otherwise like Variant 1.
Variant 4 (link) uses voting to make plays; only if a majority of players agree to an action does it occur.
Each variant allows arbitrary game names. Your group should
- for each variant
- repeat until you agree on how the variant feels in play
- pick a name
- all enter that game (make sure no one plays before all are in the game)
- play until someone wins (we encourage conversation during play)
- repeat until you agree on how the variant feels in play
- agree on how to describe how the different synchronization models changed how the game feels; you’ll need to share this with a TA for check-off.
- call a TA to come and share what you found
4 Passing Off
Explain to a TA how the different games felt different. They will be looking for evidence that you understood how the synchronization model impacted the game.