SC‐24sp‐2024‐06‐03‐Afternoon - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki

Software Construction, Spring 2024

Week 10 Afternoon

Previous Homeworks

Remember to catch up on these previous homeworks that include Rust book quizzes, Rustlings exercises, and Game of Life.

SC Homework 09

Multithreaded Game of Life

We will complete our Rust + WebAssembly implementation of Conway's Game of Life.

Dev Diary

Start a dev diary entry for today.

Performance Measurement, Single-Threaded Baseline

You want to get a baseline for how well your single-threaded game of life is performing.

First, implement the Time profiling and optimization using

  • your web browser's Performance tool in the web inspector
  • cargo bench

image

https://rustwasm.github.io/docs/book/game-of-life/time-profiling.html

Take screenshots of

  • your Universe grid
  • the performance waterfall diagram
  • your cargo bench command-line results

And add them to your dev diary entry for this lab with your interpretation of them.

Add Multi-threading

Using Rust's thread::spawn, atomic reference counter (Arc's), and mutexes if necessary, add multi-threaded support to your game of life and measure it's performance on a grid of 2048 by 2048 cells, and as high as you can go before your tick animation frames take 500 milliseconds each.

Again, take screenshots for the 2048x2048 case and the 500 millisecond case, of

  • your Universe grid
  • the performance waterfall diagram
  • your cargo bench command-line results

Add them to your dev diary entry for this lab with your interpretation of them.

Some Resources

Rust Book Chapter on shared state concurrency

You are free to use any design and implement it as long as you use at least two spawned threads and divide up rendering your Universe grid between them.

You may wish to focus on your tick method, and how to divide up the Universe grid among the threads.