learn how to develop a distributed game of life with dds

Download Learn How to Develop a Distributed Game of Life with DDS

Post on 15-Jan-2015

1.027 views

Category:

Technology

3 download

Embed Size (px)

DESCRIPTION

The Game of Life is a famous zero-player game that has been devised by John Conway more than forty years ago. It is a cellular automaton that runs on a rectangular grid of cells, each of which is either alive or dead. A set of four simple transition rules prescribe how the cells in the grid evolve from one generation to the other. Life, as it is called for short, has been able to capture the fascination of many programmers ever since it was published – mostly because of the surprising behavior it can result in. Many programmers have written implementations of Life at some point, probably in an educational context or maybe just for fun. This webinar is intended as a combination of the two: education and fun. It will show how a distributed version of Life can be implemented using the Data Distribution Service (DDS) standard from the Object Management Group (OMG). The presented Distributed Life system will be able to deal with real-life system requirements like fault tolerance, scalability and deployment flexibility. It will be shown that by leveraging advanced DDS data-management features, system developers can off-load most of the complexity associated with the distribution and fault-tolerance aspects onto the infrastructure and focus on the application logics.

TRANSCRIPT

  • 1. Your systems. Working as one.May 15, 2013Reinier Torenbeekreinier@rti.comLearn How to Develop aDistributed Game of Life with DDS

2. Agenda Problem definition: Life Distributed A solution: RTI Connext DDS Applying DDS to Life Distributed: concepts Applying DDS to Life Distributed: (pseudo)-code Advanced Life Distributed: leveraging DDS Summary Questions and Answers 3. Conways Game of Life Devised by John Conway in 1970 Zero-player game evolution determined by initial state no further input required Plays in two-dimensional, orthogonal grid ofsquare cells originally of infinite size for this webinar, toroidal array is used At any moment in time, each cell is either dead oralive Neighboring cells interact with each other horizontally, vertically, or diagonally adjacent. 4. Conways Game of LifeAt each step in time, the following transitions occur:1. Any live cell with fewer than two live neighborsdies, as if caused by under-population.2. Any live cell with two or three live neighbors lives onto the next generation.3. Any live cell with more than three live neighborsdies, as if by overcrowding.4. Any dead cell with exactly three live neighborsbecomes a live cell, as if by reproduction.These rules continue to be applied repeatedly to createfurther generations. 5. Conways Game of LifeGlider gunPulsarBlock 6. Conways Game of Life DistributedProblem description: how can Life be properlyimplemented in a distributed fashion? have multiple processes work on parts of theUniverse in parallel 7. Conways Game of Life Distributed 8. Conways Game of Life DistributedProblem description: how can Life be properlyimplemented in a distributed fashion? have multiple processes work on parts of theUniverse in parallel have these processes exchange the requiredinformation for the evolutionary steps 9. Conways Game of Life Distributed 10. Conways Game of Life DistributedProblem description: how can Life be properlyimplemented in a distributed fashion? have multiple processes work on parts of theUniverse in parallel have these processes exchange the requiredinformation for the evolutionary stepsThis problem and its solution serve as anexample for developing distributed applicationsin general 11. Conways Game of Life DistributedProperly here means: with minimal impact on the application logics let distribution artifacts be dealt with transparently let the developer focus on Life and its algorithms allowing for mixed environments multiple programming languages, OS-es and hardware asymmetric processing power supporting scalability for very large Life Universes on many machines for load balancing of CPU intensive calculations in a fault-tolerant fashion 12. Agenda Problem definition: Life Distributed A solution: RTI Connext DDS Applying DDS to Life Distributed: concepts Applying DDS to Life Distributed: (pseudo)-code Advanced Life Distributed: leveraging DDS Summary Questions and Answers 13. RTI Connext DDSA few words describing RTI Connext DDS: an implementation of the Object ManagementGroup (OMG) Data Distribution Service (DDS) standardized, multi-language API standardized wire-protocol see www.rti.com/elearning for tutorials (some free) a high performance, scalable, anonymouspublish/subscribe infrastructure an advanced distributed data managementtechnology supporting many features know from DBMS-es 14. RTI Connext DDSDDS revolves around the concept of a typed data-space that consists of a collection of structured, observableitems which go through their individual lifecycle ofcreation, updating and deletion (CRUD) are updated by Publishers are observed by Subscribers is managed in a distributed fashion by Connext libraries and (optionally) services transparent to applications 15. RTI Connext DDSDDS revolves around the concept of a typed data-space that allows for extensive fine-tuning to adjust distribution behavior according toapplication needs using standard Quality of Service (QoS) mechanisms can evolve dynamically allowing Publishers and Subscribers to join and leaveat any time automatically discovering communication pathsbetween Publishers and Subscribers 16. Agenda Problem definition: Life Distributed A solution: RTI Connext DDS Applying DDS to Life Distributed: concepts Applying DDS to Life Distributed: (pseudo)-code Advanced Life Distributed: leveraging DDS Summary Questions and Answers 17. Applying DDS to Life DistributedFirst step is to define the data-model in IDL cells are observable items, or "instances" row and col identify their location in the grid generation identifies the "tick nr" in evolution alive identifies the state of the cell 18. module life {struct CellType {long row; //@keylong col; //@keyunsigned long generation;boolean alive;};}; 19. Applying DDS to Life DistributedFirst step is to define the data-model in IDL cells are observable items, or "instances" row and col identify their location in the grid generation identifies the "tick nr" in evolution alive identifies the state of the cell the collection of all cells is the CellTopic Topic cells exist side-by-side and for the Universe conceptually stored "in the data-space" in reality, local copies where needed 20. row: 16col: 4generation: 25alive: false 21. Applying DDS to Life DistributedEach process is responsible for publishing thestate of a certain subset of cells of the Universe: a rectangle or square area with corners(rowmin,colmin)i and (rowmax,colmax)i for process i 22. (1,1) (10,10) 23. Applying DDS to Life DistributedEach process is responsible for publishing thestate of a certain subset of cells of the Universe: a rectangle or square area with corners(rowmin,colmin)i and (rowmax,colmax)i for process i each cell is individually updated using thewrite() call on a CellTopic DataWriter middleware analyzes the key values (row,col) andmaintains the individual states of all cells updating happens generation by generation 24. Applying DDS to Life DistributedEach process subscribes to the required subsetof cells in order to determine its current state: all neighboring cells, as well as its "own" cells 25. Applying DDS to Life DistributedEach process subscribes to the required subsetof cells in order to determine its current state: all neighboring cells, as well as its "own" cells using a SQL-expression to identify the cellssubscribed to (content-based filtering) complexity is "Life-specific", not "DDS-specific" 26. "((row >= 1 AND row = 1 AND col = 8 AND row = 8 AND col

Recommended

View more >