Sunday, 18 August 2013

Is an atomic action supposed to be deterministic?

Is an atomic action supposed to be deterministic?

I was reading about the at most once property that defines what an atomic
action is and I've been curios about this example:
x = 0, y = 0
x = y + 1 || y = y + 1
If we use the 'at most once' definition, we can say that, indeed, x = y +
1 is atomic because
y is only referenced in an another thread and
x is not being read by any thread
But the result of this action is not deterministic, it could be 1 or 2
depending on which operation is being computed first.
I might be wrong from the start, isn't atomicity suppose to grant some
kind of determinism?

No comments:

Post a Comment