Skip to main content

Practice · 1 of 4

The Contended Account

CHALLENGE
Difficulty: advanced+25 XP

Given a mutex and a global long long account (both in your editor). Implement void deposit(long long amount) — add amount to account under the mutex — and long long balance(void) returning it. The grader hammers it from many threads; a lost update means a lost test.

Back to lesson: Practice: Synchronization Drills