News for hackers. Stuff that matters.
Re:Data races in Python, despite the Global Interpreter Lock by reitzensteinm on Monday February 21, 2022 @10:56PM (#30423840)
It absolutely is possible for a value to decrease, and that does not require reads or writes to not be atomic.

Picture Thread A reading the value of X=0, then the Python scheduler preempts the thread. Then Thread B fetches and increments X three times. X is now 3. Thread A then runs again, and increments the value of X it had read previously, (0+1), then writes 1 to X.

The memory location just went: 0,1,2,3,1

I'm working on a series for my blog called Temporal Fuzzing that simulates these edge cases in a virtual machine. It is often very hard to predict the total set of possible behaviour given random interleavings.

https://www.reitzen.com/post/temporal-fuzzing-01/

There are no comments on this comment yet.