News for hackers. Stuff that matters.
Re:Race Condition vs. Data Race (2011) by didibus on Monday July 22, 2019 @01:20PM (#20500160)
Maybe I didn't understand the article properly then. Their example of a data race is

account.activity = true;

Which two threads could perform concurrently.

Now from my understanding, the issue is that the hardware, OS, runtime and compiler might not guarantee that this assignment is atomic. Thus if two threads were to perform it concurrently, the result would be undefined, in that maybe the value ends up being true, or maybe it ends up corrupted, or maybe it is still false, or it will eventually be true, but for a while, if you read back the value it would still be false, etc.

Edit: Also I don't think you understood my example. When I lay out T1 and T2, I'm talking about two threads concurrently executing a = a + 1;. Which is a data race, by their definition. But I'm saying that the issue with data races are that they can lead to race conditions at the assembly level. Thus a data race is really just a race condition at the assembly or even hardware level.

There are no comments on this comment yet.