← Questions
Two threads updating a shared counter with different stop conditions
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Start two threads that both update a shared counter. One stops when the counter reaches 10 and returns a snapshot of it; the other stops after one second and returns its snapshot. Print the sum of the two snapshots. Make the updates safe, explain the race you would get without synchronization, and say what output is possible.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
