Pagini recente » Diferente pentru blog/problema-majoritatii intre reviziile 20 si 22 | Monitorul de evaluare | Istoria paginii utilizator/david_curca9 | Diferente pentru blog/dexonline intre reviziile 6 si 1 | Diferente pentru blog/counter intre reviziile 7 si 12
Diferente pentru
blog/counter intre reviziile
#7 si
#12
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(c) |
== code(python) |
import threading
num_threads = 5
print counter
==
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 reading and writing to the variable are atomic operations. What's the minimum value the counter can have after all threads finished.
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.
Diferente intre securitate:
Diferente intre topic forum: