There are two processes access the shared variables x,y, and z. Each process accesses a different replica of the store used to hold these variables. value of x,y and z is 0 initially.
Process 1:
x = 1;
if (y == 0)
z++;
And Process 2:
y = 1;
if (x == 0)
z++;
After completing both statements what are the possible values of z in a) sequential and b) casual consistency model?
I know that in the sequential consistency, processes are executed in some sequential order specified by the program. I believe that in the example above,the result for z would be zero in sequential consistency model as two processes executed at the same time in the order specified in the processes. So, none of the if conditions are executed. But I am not sure.
For the casual one, related writes should be in the same order in all processes. Concurrent writes can be different order. I can't figure out how this rule works in our example.