ChapterPDF Available

PARALLEL: Facilitate Learning Concurrent and Parallel Programming

Authors:

Abstract and Figures

Parallel is a 2D puzzle game designed to facilitate the learning of concurrent and parallel programming (CPP) concepts. CPP is increasingly important in today's world of parallel hardware, yet very few games currently exist to help students learn and practice these skills. In each level in Parallel, players direct arrows to deliver packages to designated spots by placing different components (e.g., semaphores and signals) on the track. Solving the puzzles corresponds to designing a synchronization mechanism to address some of the most important problems in CPP such as deadlocks, where two computer programs sharing the same resource are preventing each other from accessing that resource; or race conditions, where a system attempts to perform two or more operations at the same time but because of the way the system is, they must be done in a proper order. By creating a synchronization mechanism through the placement of semaphores and buttons, the arrows in a LEARNING, EDUCATION, AND GAMES, VOL. 3 313 level will be able to bypass obstacles and deliver the correct amount of package to their intended drop-off points. Parallel is among the first games to specifically focus on the CPP concepts of threads, synchronization, and on emphasizing the difference between sequential and parallel programming, making it novel for teachers who are looking for new ways to introduce these topics into their classroom rather than the typical lecture about theoretical ideas. Parallel aims to give students a visual representation of these concepts in order to supplement theoretical classwork Figure 1. An Advanced Level in Parallel Based on the Dining Philosophers Problem. HOW TO USE THE GAME Students can play Parallel as a standalone puzzle educational game, or they can also use it in conjunction with a concurrent and parallel programming (CPP) course. The puzzles in Parallel are non-deterministic, meaning that the arrows can move at random speeds, which echoes one of the key challenges of learning CPP (Ontañón, Zhu, Smith, Char, Freed, Furqan, 2017). Non-determinism creates different scenarios of when and how the arrows move, leading to potentially varied package delivery outcomes, every time the player plays the game. A player can "test" their solution to see whether it works in one simulation (see Figure 1). The main goal for the game is to create a situation in each level in which all possible common parallel programming problems are accounted for (i.e. deadlocks, race conditions, etc.) and the packages will deliver in every possible scenario; this being a representation of what it means to be completing a CPP. Once the player is confident that they have addressed all possible problems, they can "submit" their solution. The game will then check whether the provided solution works for all possible scenarios, rather than "testing" which will only check for one possible scenario, to determine whether the player has solved the level. The game contains a series of hand-designed levels by researchers at Drexel University, and these levels have particular parallel problems that need to be solved. In addition, the game contains 314 KAREN SCHRIER (EDITOR) procedurally generated (PCG) levels for additional practice (Valls-Vargas, Zhu, Ontañón, 2017). These PCG levels are levels that the computer has generated based on a students' previous game play. The two types of levels make up the various levels that students will see throughout the game, i.e. level 1-6 might be hand authored levels, while level 48 might be a PCG level. The game levels work on a scaffolded structure with the beginning levels focusing on one basic CPP concept (e.g., deadlock), whereas an advanced level may contain a well-known CPP problem (e.g., the Dining Philosophers problem, or the Smokers' problem), which would take more training and understanding of earlier concepts in order to complete. At Drexel University, we have used the game as part of an upper-level computer science course, specifically a course on concurrent programming, in which the game was integrated as both homework and classwork. As part of the course, students were asked to complete levels at home that covered common parallel problems that they were discussing in class. In class, new game levels were used to help reinforce a certain topic such as blocking off a critical section. Students were asked to play the tutorial part of the game in class so that the instructor could answer any initial questions about the game. The levels were then assigned to students four times throughout the semester based on which concepts they were discussing in class. At the time of the first round of homework, students were discussing critical sections in class, a part of a program where systems are trying to complete tasks at the same time, so students were asked to play two levels that had a problem in which they needed to block off a critical section. After students completed these levels, a handout was given in class which had a picture of one of the levels, and students discussed with the professor the problem that the level portrayed, and how best to solve that problem. A similar process occurred for the remaining three rounds of homework assignments over the course of the semester. We encourage professors that are using this game as part of their class to take a look at the order of concepts that they will be teaching and choose to assign game levels that best reflect the concepts that they are teaching at the time. We also encourage instructors to review game levels in class to point out specific instances in the game that related to the parallel programming concepts that they are teaching, in order to help students bridge the divide between the visual aspects of the game and PPC concepts (Alderfer, Smith, Ontañón, Char, Nebolsky, Zhu, 2018). For example, it is helpful for an instructor to project a game level and discuss the CPP problems that exist in that level (e.g. deadlock), and review how this problem would be solved not only in the game, with use of game elements like semaphores and buttons, but in programming language as well. When playing through the various puzzles, students should try and make connections to common CPP problems as they play the game, and jot down the connections that they make. It is also helpful for students to keep a list of how the abstract concepts might connect to specific aspects of code (i.e. tracks represent threads etc.).
Content may be subject to copyright.
PARALLEL
KATELYN ALDERFER, JICHEN ZHU,EVAN FREED,BRIAN K. SMITH, BRUCE CHAR, AND SANTIAGO
ONTAÑÓN
Game: Parallel
Developer: Drexel University GAIMS Center
Year: 2018
Platform(s): Windows, OS X
Number of players: Single player
Genre: Logic; puzzle; simulation
Type of game: Computer-based digital game
Curricular connections: Computer science; programming
Possible skills taught: Systems thinking; parallel thinking; problem solving; parallel and concurrent
programming
Audience: 18+ (college students; young adults)
Length of time: At least 10 hours
Where to play: Both Inside and Outside the classroom
Cost: Free
URL: http://digm.drexel.edu/pxl/parallel-programming/
SUMMARY
Parallel is a 2D puzzle game designed to facilitate the learning of concurrent and parallel programming
(CPP) concepts. CPP is increasingly important in today’sworld of parallel hardware, yet very few
games currently exist to help students learn and practice these skills. In each level in Parallel,players
direct arrows to deliver packages to designated spots byplacing different components (e.g.,
semaphores and signals) on the track. Solving the puzzles corresponds to designing a synchronization
mechanism to address some of the most important problems in CPP such as deadlocks, where
two computer programs sharing the same resource arepreventing each other from accessing that
resource; or race conditions, whereasystem attempts to perform two or more operations at the
same time but because of the way the system is, they must be done in a proper order.By creating
a synchronization mechanism through the placement of semaphores and buttons, the arrowsina
LEARNING, EDUCATION, AND GAMES, VOL. 3 313
level will be able to bypass obstacles and deliver the correct amount of package to their intended
drop-off points. Parallel is among the first games to specificallyfocus on the CPP concepts of threads,
synchronization, and on emphasizing the difference between sequential and parallel programming,
making it novel for teachers who are looking for new ways to introduce these topics into their
classroom rather than the typical lecture about theoretical ideas. Parallel aims to give students a visual
representation of these concepts in order to supplement theoretical classwork
Figure 1. An Advanced Level in Parallel Based on the Dining Philosophers Problem.
HOW TO USE THE GAME
Students can playParallel as a standalone puzzle educational game, or they can also use it in
conjunction with a concurrent and parallel programming (CPP) course. The puzzles in Parallel are
non-deterministic, meaning that the arrows can move at random speeds, which echoes one of the
key challenges of learning CPP(Ontañón, Zhu, Smith, Char,Freed, Furqan, 2017). Non-determinism
creates different scenarios of when and how the arrowsmove, leading to potentiallyvaried package
delivery outcomes, every time the player plays the game. Aplayer can “test” their solution to see
whether it works in one simulation (see Figure 1). The main goal for the game is to create a situation
in each level in which all possible common parallel programming problems are accounted for (i.e.
deadlocks, race conditions, etc.) and the packages will deliver in every possible scenario; this being a
representation of what it means to be completing a CPP. Once the player is confident that they have
addressed all possible problems, they can “submit” their solution. The game will then check whether
the provided solution works for all possible scenarios, rather than “testing” which will only check for
one possible scenario, to determine whether the player has solved the level.
The game contains a series of hand-designed levels byresearchers at Drexel University, and these
levels have particular parallel problems that need to be solved. In addition, the game contains
314 KAREN SCHRIER (EDITOR)
procedurally generated (PCG)levels for additional practice (Valls-Vargas, Zhu, Ontañón, 2017). These
PCG levels arelevels that the computer has generated based on a students’ previous game play. The
two types of levels make up the various levels that students will see throughout the game, i.e. level
1-6 might be hand authored levels, while level 48 might be a PCG level. The game levels work on
a scaffolded structure with the beginning levels focusing on one basic CPP concept (e.g., deadlock),
whereas an advanced level may contain a well-known CPPproblem (e.g., the Dining Philosophers
problem, or the Smokers’ problem), which would take more training and understanding of earlier
concepts in order to complete.
At Drexel University,we have used the game as part of an upper-level computer science course,
specifically a course on concurrent programming, in which the game was integrated as both
homework and classwork. As part of the course, students wereasked to complete levels at home that
covered common parallel problems that they were discussing in class. In class, new game levels were
used to help reinforce a certain topic such as blocking off a critical section. Students wereasked to
play the tutorial part of the game in class so that the instructor could answer any initial questions
about the game. The levels were then assigned to students four times throughout the semester based
on which concepts they were discussing in class. At the time of the first round of homework, students
were discussing critical sections in class, a part of a program wheresystems are trying to complete
tasks at the same time, so students wereasked to play twolevels that had a problem in which they
needed to block off a critical section. After students completed these levels, a handout was given in
class which had a picture of one of the levels, and students discussed with the professor the problem
that the level portrayed, and how best to solve that problem. A similar process occurred for the
remaining three rounds of homework assignments over the course of the semester.
We encourage professors that are using this game as part of their class to take a look at the order
of concepts that they will be teaching and choose to assign game levels that best reflect the concepts
that they are teaching at the time. We also encourage instructors to review game levels in class to
point out specific instances in the game that related to the parallel programming concepts that they
are teaching, in order to help students bridge the divide between the visual aspects of the game and
PPC concepts (Alderfer,Smith, Ontañón, Char,Nebolsky, Zhu, 2018). For example, it is helpful for an
instructor to project a game level and discuss the CPPproblems that exist in that level (e.g. deadlock),
and review how this problem would be solved not only in the game, with use of game elements like
semaphores and buttons, but in programming language as well.
When playing through the various puzzles, students should try and make connections to common
CPPproblems as they play the game, and jot down the connections that they make. It is also helpful
for students to keep a list of how the abstract concepts might connect to specific aspects of code (i.e.
tracks represent threads etc.).
Acknowledgements
The Parallel project is partially supported byCyberlearning NSF grant 1523116. The authors would
like to thank the rest of the project team.
LEARNING, EDUCATION, AND GAMES, VOL. 3 315
TIPS &BEST PRACTICES
1. Educators should play through the tutorial to get a feel for the game’s UI as well as to gather
some useful tips.
2. If playing as part of a class, teachers should make sure that the game is set up on all students’
computers in advance.
3. If playing as part of a class, teachers should set guidelines or create a syllabus for game play so
that students know which levels to play for that day.
4. Teachers should leave time in class to discuss the different levels played, and how they connect
to CPP.
5. If playing as a standalone game, teachers should note that levels get progressively more
difficult. If students are having trouble with an advance level it may help to go back to an
earlier level.
RELATED GAMES &MEDIA
The Deadlock Empire (http://deadlockempire.github.io)
Scratch (https://scratch.mit.edu)
FURTHER READING
Akimoto, N., & Cheng, J. (2003). An educational game for teaching and learning concurrency.
In Proceedings of the 1st International Conference on Knowledge Economy and Development of Science and
Technology (KEST’03), Honjo, Japan (pp. 34-39).
Alderfer, K. B., Smith, B. K., Ontañón, S., Char, B., Nebolsky,J., Zhu, J. (2018). Lessons learned from
an interactive educational computer game about concurrent programming. In Proceedings of the 49th
ACM Technical Symposium on Computer Science Education (pp. 1077-1077). ACM.
Amresh, A., & Anderson, R. (2014). Parallel Programming Using Games: A Hands-On Approach.AKPeters,
Ltd.
Ontañón, S., Zhu, J., Smith, B. K., Char, B., Freed, E., Furqan, A. (2017). Designing visual metaphors
for an educational game for parallel programming. In Proceedings of the 2017 CHI Conference Extended
Abstracts on Human Factors in Computing Systems (pp. 2818-2824). ACM.
Valls-Vargas, J., Zhu, J., & Ontañón, S. (2017). Graphgrammar-based controllable generation of
puzzles for a learning game about parallel programming. In Proceedings of the 12th International
Conference on the Foundations of Digital Games (p. 7). ACM.
316 KAREN SCHRIER (EDITOR)
Learning, Education, and Games, Vol. 3
LEARNING, EDUCATION, AND GAMES, VOL. 3
100 Games to Use in the Classroom & Beyond
KAREN SCHRIER (EDITOR)
Carnegie Mellon University: ETC Press
Pittsburgh, PA
Learning, Education, and Games, Vol. 3 by ETC Press is licensed under a Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International License, except where otherwise noted.
Copyright © by Karen Schrier and ETC Press 2019 http://press.etc.cmu.edu/
ISBN: (Print)
ISBN: (eBook)
TEXT: The text of this work is licensed under a Creative Commons Attribution-NonCommercial-NonDerivative 2.5 License
(http://creativecommons.org/licenses/by-nc-nd/2.5/)
IMAGES: All images appearing in this work are the property of the respective creators, and are not released into the Creative
Commons. The respective owners reserve all rights.
ResearchGate has not been able to resolve any citations for this publication.
ResearchGate has not been able to resolve any references for this publication.