Parallel multithreaded READ access. Could this cause any problems?

Is there any potential for problems where multiple threads read values static

or can be read by any number of threads simultaneously without issue? (FROM#)

+2


source to share


3 answers


concurrent reading is fine, provided the write operation is not in progress.



+3


source


Yes, static members can be read at the same time without any problem. What to worry about is write operations. In most cases, it is best to block all threads while writing to ensure that no concurrency issues are introduced as a result of the write operation.



But a concurrent read without any writes will work fine, without the need for locking or any concurrecy-related corruption.

+2


source


Everything will be fine until we reach the era of quantum computing, at which point the Heisenberg uncertainty principle indicates that readings will begin to lead suspiciously, as he writes.

At least that would be pretty funny. In fact, I know practically nothing about quantum computing.

I think you're okay.

0


source







All Articles