Lab 10: Threads
Due: 2026-04-27 at 23:59
In this lab, you’re going to take a single threaded program and turn it into a multithreaded program by splitting up the computation into multiple threads.
You will learn
- how to spawn threads; and
- how to return values from threads.
Preliminaries
First, find a partner. You’re allowed to work by yourself, but I highly recommend working with a partner. Click on the assignment link. One partner should create a new team. The second partner should click the link and choose the appropriate team. (Please don’t choose the wrong team, there’s a maximum of two people and if you join the wrong one, you’ll prevent the correct person from joining.) You cannot choose a team name you’ve used previously.
Once you have accepted the assignment and created/joined a team, you can clone the repository and begin working.
Compiler warnings and errors
Make sure your code compiles and passes clippy without errors or warnings.
That is, running
$ cargo clean
$ cargo build
$ cargo clippy
should build your program without errors or warnings.
Formatting
Your code must be formatted by running cargo fmt.