Who asked: the platform team at Ridgeway Freight, a fictional haulage company whose dispatch servers write one log line per request.
Why: they want live totals while the logs stream in from several servers at once: how many lines at each level, how long each service spends, and which service is slowest. One thread cannot keep up, so the service runs a pool of worker threads.
The data: lines like billing ERROR 120: a service name, a level (INFO, WARN or ERROR) and a duration in whole milliseconds. Some lines are malformed: missing fields, unknown levels, extra words, negative or non-numeric durations.
Done looks like: parse that accepts exactly the valid lines; a Stats class that many threads can update and read at once; slowest() with ties broken by name; a closable LineQueue; a LogService whose workers parse and count every line submitted from any thread, with finish() closing the queue and joining the workers; and malformed lines counted rather than lost, with finish() safe to call twice.
Six steps, each building on your code from the step before, from a parser to a multithreaded service. At each step, run the tests and read what fails: the new requirement usually brings a new way to be wrong under some schedule.
Threads here are simulated. Your program runs on one real thread while a scheduler switches between your threads at shared reads and writes, locks, atomic operations, waits, yields and sleeps, and every test runs under 12 different schedules. The order things can happen in, races at those points and deadlocks are faithful. Real parallel speed-up and weak memory-order effects are not.