Step Into Labs

Step Into Rust · Module exam · Sharing & Concurrency

Exam: The Bank

Four worker threads apply transfers from a channel to shared accounts. Not one cent may go missing.

Part of Step Into Rust. The full module exam, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

A bank receives a stream of transfers and has four worker threads to apply them. The workers take transfers from a shared queue and update the shared balances. Money may move in any order, but at the end every balance must be exact and the total must not have changed by a single cent. Bad transfers are reported and never reach the workers.

In this module exam

Missions

  1. Apply every transfer exactly once