0

Hi, I'm struggling to understand how would the following two processes would be processed according to Causal Consistency Model...

Initially x=y=0

Process A
x = 1
if ( y = 0) z++

Process B
y = 1
if (x = 0) z++

I would appreciate if someone could reply by giving the step by step analysis of the processing. Thx

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by rubberman
0

Maybe this will help: http://en.wikipedia.org/wiki/Causal_consistency

One point, unrelated to your causal linkage, is that your conditional statements of if (x = 0) and if (y = 0) should more appropriately be if (x == 0) and if (y == 0) so that one can distinguish between an assignment and a boolean comparison.

So, as for your question, the end value for Z is indeterminate since either process may assign x or y in any order, and at any time. IE, it could be that Z ends up with a value of 0 or 1. Consider possible steps:

1. A assigns 1 to x
2. B assigns 1 to y
3. A tests and finds y != 0 - no z increment results
4. B tests and finds x != 0 - no z increment results

end: z == 0 (you can switch order of process operations and get same z result)

or

1. A assigns 1 to x
2. A tests y and finds y == 0 - z increment results
3. B assigns 1 to y
4. B tests x and finds x != 0 - no increment results

end: z == 1 (you can switch order of A and B operations and get same z result)

So, z is causally linked to the values of x and y via the order they are set and read.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.