3 ms·
These things are running concurrently with each other though. Concurrent operations can happen one after the other, and Python's threads are more about concurre
by verdagon 5y ago
These things are running concurrently with each other though. Concurrent operations can happen one after the other, and Python's threads are more about concurrency than parallelism. If these definitions instead mentioned "simultaneous" or "in parallel", I could agree with your belief.
(Edited in response to your edit)
- Kranar 5y agoThere need not be any parallelism or simultaneity for a data race to occur. What matters is that writes occur concurrently with another read/write, not whether they occur in parallel. For example it's possible on a single core CPU to have one thread operate on the higher bits of a 32-bit memory location then yield to second thread that operates on the lower 32-bits of the same memory location so that the end result is a clobbered write. At no point do the two threads run simultaneously and yet this would still be an example of a data race. Python's GIL makes such an access impossible on any platform it runs on.