Pagini recente » Diferente pentru problema/sever intre reviziile 27 si 26 | Diferente pentru blog/square-root-trick intre reviziile 80 si 102 | Atasamentele paginii Călătorie1 | Diferente pentru problema/bunicu intre reviziile 5 si 4 | Diferente pentru blog/counter intre reviziile 12 si 9
Diferente pentru
blog/counter intre reviziile
#12 si
#9
Nu exista diferente intre titluri.
Diferente intre continut:
What's the minimum value this Python code can print:
What's the minimum value this python code can print:
== code(python) |
== code(c) |
import threading
num_threads = 5
print counter
==
The fact that the code is in Python doesn't really matter. Basically you're given 5 threads that each increment an integer variable _counter_ exactly 10 times. The variable isn't guarded by any lock. You can assume that reads and writes to the variable are atomic operations. What's the minimum value the counter can have after all threads finished.
Basically you're given 5 threads that each increment an integer variable _counter_ exactly 10 times. The variable isn't guarded by any lock. You can assume that reads and writes to the variable are atomic operations. What's the minimum value the counter can have after all threads finished.
Diferente intre securitate:
Topicul de forum nu a fost schimbat.