This homework assignment is about getting our feet wet with modeling concurrent systems! We are going to be simulating the very concurrent and complex nature of making a Pizza from scratch in a Kitchen with multiple chefs!
This simulation is quite intricate and will leverage much of your current Rust knowledge. However, Rust's style of concurrent operation with Tokio and its synchronization primitives is a lot to read through. You will need to make good use of your reading resources to manage them successfully and not get overwhelmed! With what truly little time we have in class, you will need to rely on the reading material to get you the full picture. The sections below give you direct and indirect help with organizing your thoughts about threads, concurrent ownership, and use of synchronization primitives in Rust.
In "The Rust Language Book" read:
Optionally for help with the homework:
While it's not one of your required materials, the Rust by Example docs are associated with the Rust Language Book and are a great resource for understanding the concepts in the book in a more direct programmatic way. You should go through all of it but for now, Read section 18: Error Handling and Section 19: Std Library Types.
Don't read this in its entirety, but the Rust Tokio library is a powerful tool for concurrent programming in Rust. It is a bit different from the standard library and is a bit more complex to understand. However, it is a great resource for looking up details related to the use of Futures, Channels, Async and Await, and more in the codebase.
This programming assignment is about implementing a concurrent pizza-making simulation in Rust!
Your repository will contain the following files:
CMSI-3510-HW2/
āāā .gitignore
āāā life-of-pie/
ā āāā Cargo.toml
ā āāā Cargo.lock
ā āāā src/
ā āāā parallel/
ā ā āāā mod.rs
ā ā āāā data_parallel.rs
ā ā āāā task_parallel.rs
ā āāā chef.rs
ā āāā equipment.rs
ā āāā error.rs
ā āāā fridge.rs
ā āāā ingredients.rs
ā āāā kitchen.rs
ā āāā proving_room.rs
ā āāā lib.rs
ā āāā main.rs
āāā README.md
This programming homework is brought by Babish! Well not directly, but instead it is modeled after the pizza dough making process laid out in the following video linked below! Make sure to watch this as otherwise the simulator you will be programming will be more than a little confusing.
Pizza Dough | Basics with Babish
Need a refresher on how to interact with the HW for this course? Watch the helper video posted to Zoom via the link below!
You can find the GitHub Classroom assignment link and the Brightspace turn in link using the buttons at the top of this section.
In this optional section you will pick a small async/concurrent Rust project of your choosing and ship it from scratch! HW2 only scratches the surface of what Tokio, channels, and Rust's synchronization primitives can do. This optional gives you the chance to take that toolkit out for a real spin.
Pick one of the project ideas below (or pitch your own!), follow its starter article to get oriented, and then build it out in your own empty repo.
Mini-Redis server. Build a tiny in-memory key-value server that speaks a subset of the Redis protocol over TCP. Tokio's official tutorial walks through exactly this, end-to-end.
Concurrent web crawler. Given a starting URL, crawl pages in parallel up to a depth limit and save the titles. Great practice with tokio::spawn, JoinSet, and bounded channels.
Parallel file processor. A CLI that walks a directory and runs some operation (image resize, hash, word-count, etc.) over many files in parallel. A great place to compare Tokio's task model against Rayon's data-parallel par_iter.
Actor-style chat server. A TCP chat server where each connected client is its own task and messages are broadcast to other clients via channels.
Bring your own. If something else excites you (a job scheduler, a port scanner, a parallel log tailer, etc.), pitch it in your README. The only requirements are that it is meaningfully concurrent and that it uses Tokio (or Rayon, or both).
Whichever idea you pick, your repo must include:
cargo test. At least one of those tests should exercise the concurrent behavior (e.g., spawn multiple tasks against your server/queue and check the result).README.md explaining what you built, which starter article you used, and how to run and test it.I have made an empty Github assignment for you to pull and create your Rust project from scratch (This is out of convenience so that I can use Github classroom to collate all your projects rather than go through being added to all the repos). Feel free to architect your project as you choose.
Since the repository is private, feel free after you are done to copy it over into a public repository to show off on your Github!
Earning points in this optional is not as rigid since you may pick your own project. With that said, to earn full points you must:
README.md that names your starter article, describes what you built, and explains how to run and test it.cargo test, at least one of which exercises the concurrent behavior.You do not have to implement every "stretch" idea suggested by the starter article ā the basic working version is enough.
Below is the button that links to the Github Optional Assignment repository. The Brightspace submission link is at the top of this section.