Pagini recente » Diferente pentru problema/fft intre reviziile 3 si 4 | Diferente pentru problema/permutare5 intre reviziile 7 si 6 | Diferente pentru problema/heavytask intre reviziile 4 si 3 | Diferente pentru problema/bigfour intre reviziile 9 si 1 | Diferente pentru blog/counter intre reviziile 3 si 2
Diferente pentru
blog/counter intre reviziile
#3 si
#2
Nu exista diferente intre titluri.
Diferente intre continut:
What's the minimum value this code can print:
Given 5 threads that each increment an integer counter variable exactly 10 times. The variable isn't guarded by any lock. You can assume that reading and writing to the variable are atomic operations. What's the minimum value the counter can have after all threads finished.
In Python it would look like this:
== code(c) |
import threading
print counter
==
Basically you're given 5 5 threads that each increment an integer counter variable exactly 10 times. The variable isn't guarded by any lock. You can assume that reading and writing to the variable are atomic operations. What's the minimum value the counter can have after all threads finished.
The puzzle asks for the minimum value this code can print.
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.