Presentation is loading. Please wait.

Presentation is loading. Please wait.

Project 1CS-4513, D-Term 20071 Programming Project #1 Concurrent Game of Life Due Friday, March 20.

Similar presentations


Presentation on theme: "Project 1CS-4513, D-Term 20071 Programming Project #1 Concurrent Game of Life Due Friday, March 20."— Presentation transcript:

1 Project 1CS-4513, D-Term 20071 Programming Project #1 Concurrent Game of Life Due Friday, March 20

2 Project 1CS-4513, D-Term 20072 Assignment Implement a version of Conway’s Game of Life on multiple processes or threads –In this project, all processes or threads are on the same computer –In a future project, they will be distributed across different computers

3 Project 1CS-4513, D-Term 20073 Objective Refresh your memory about concurrency and synchronization Build a concurrent application that has non- trivial synchronization demands Lay the groundwork for a non-trivial distributed computation

4 Project 1CS-4513, D-Term 20074 Conway’s Game of Life See http://www.math.com/students/wonders/life/life.html Introduced by John Conway Scientific American, April 1970, p. 120 Played on an “infinite” grid of squares Each square may be occupied or unoccupied Rules define how occupancy changes from one generation to next

5 Project 1CS-4513, D-Term 20075 Rules of Game of Life If an occupied square has on 0 or 1 occupied neighbors, it dies of loneliness If an occupied square has 4 or more occupied neighbors, it dies of overcrowding If an occupied square has 2 or 3 occupied neighbors, it survives to the next generation If an unoccupied square has precisely 3 occupied neighbors, it “gives birth,” becoming occupied in next generation

6 Project 1CS-4513, D-Term 20076 Rules of Game of Life (continued) Game terminates if –Grid becomes empty –Pattern of occupancy repeats itself from a previous pattern –A predefined number of generations is reached

7 Project 1CS-4513, D-Term 20077 Concurrent Game of Life Divide grid into fixed-size subgrids 32  32 cells for this project Each subgrid is computed by a separate process or thread Called a player Each player must get information about cells on boundary from neighboring players Each player must tell neighboring players about its cells on its boundary

8 Project 1CS-4513, D-Term 20078 Concurrent Game of Life (continued) Parent process or thread creates each player Initial value of subgrid (32  32 array) Array of objects denoting nearest neighbors –Null object  player is on a boundary Invoking concurrent life life X Y gen filename print pause X, Y are number of players in x- and y-dimension gen is number of generations to play filename is file with initial grid pattern print, pause for debugging

9 Project 1CS-4513, D-Term 20079 Concurrent Game of Life (continued) File of initial grid positions –Lines of “x” and “o” characters “x” denotes occupied; “o” denotes unoccupied –No spaces between characters –Center initial value in array of grids E.g., oxx xxo oxo denotes the R-pentomino

10 Project 1CS-4513, D-Term 200710 Implementation Any of C, C++, or Java Must compile and run on Fossil Lab machines Synchronization primitives –Java SYNCHRONIZED objects –Semaphores on C++ classes –… messages, other forms of IPC

11 Project 1CS-4513, D-Term 200711 Testing Concurrent programs are harder than sequential ones At least three non-trivial test patterns –Exercise all sub-grids –Test communication across boundaries Discuss further testing in write-up

12 Project 1CS-4513, D-Term 200712 Submission Submit via myWPI Source code & header files Makefile Test patterns and output Write-up We will Compile/build using make Run your test cases Run our test cases

13 Project 1CS-4513, D-Term 200713 Grading Successful submission — 10% Clear, cogent write-up — 10% Success build on Fossil Lab machines with no errors or warnings — 15% At least three non-trivial test patterns – 15% Successful run of your test patterns — 25% Successful run of our test patterns — 25%

14 Project 1CS-4513, D-Term 200714 Questions?


Download ppt "Project 1CS-4513, D-Term 20071 Programming Project #1 Concurrent Game of Life Due Friday, March 20."

Similar presentations


Ads by Google