project 2
play

Project 2 Parallel programming To be done by teams of two people - PowerPoint PPT Presentation

Project 2 Parallel programming To be done by teams of two people Deadline : December 18, 2017, 23:59 Bouncy squares Dimensions 256 px (customizable) 16px 16px 256 px (customizable) Speed Velocity on x-axis {-1,0,1} Velocity on y-axis


  1. Project 2 Parallel programming To be done by teams of two people Deadline : December 18, 2017, 23:59

  2. Bouncy squares

  3. Dimensions 256 px (customizable) 16px 16px 256 px (customizable)

  4. Speed Velocity on x-axis  {-1,0,1} Velocity on y-axis  {-1,0,1} A square can move towards 8 directions (or stay in the same spot)

  5. Collisions/Out of bounds • Out of bounds • Change the direction that lead to crossing the boundary X-velocity = 1 X-velocity = 1 X-velocity = -1 Y-velocity = 1 Y-velocity = 1 Y-velocity = 1

  6. Collisions/Out of bounds (2) • Collisions • Swap the velocities (special rule for more than 2 squares) X-velocity = 1 X-velocity = -1 X-velocity = 1 X-velocity = -1 X-velocity = -1 X-velocity = 1 Y-velocity = 0 Y-velocity = 0 Y-velocity = 1 Y-velocity = 1 Y-velocity = 1 Y-velocity = 0

  7. Parallel Processing • Single-process program provided • Each square = 1 process (workers) • Master process for input/output • Position of squares in shared memory • Velicities NOT in shared memory • Shared memory protected by semaphores (if needed) • Communication between workers and master process by semaphores and shared memory • Communication between workers by message queues

  8. Parallel processing (2) Worker N : Master process: – Move square N – Wait for all workers – See if out of bounds or collision – Display new positions – If so, find new direction (possibly – Warn Workers that display is done by interacting with another process) – If user pressed <ENTER>, quit program properly – Warn Master process that movement is done – Wait for Master process to display

  9. Coding Guidelines • Focus on code clarity and understandability before efficiency • Still, your code shouldn’t be unreasonably inefficient (tip: use as few IPCs as possible, avoid repeating useless operations) • Document your code !! • Functions should be documented: – Parameters – Operations performed

  10. Files and submission You are provided with: • Bounce.zip : a zip archive containing C implementation of the bouncy squares program using SDL displays. You can use it as basis for your implementation. You must submit in a ZIP file named « sXXXXXX_NAME1_sYYYYYY_NAME2.zip » : • The source code of your program (.c, .h, makefile) • report.pdf : Describe using simplified C syntax how you implemented the synchronization between processes. Submitting other files will be sanctioned

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend