How is causal consistency different from consistent consistency?

I understand that in a sequential sequence, all processes must be processed sequentially. For instance:

Process 1 Process 2 x = 1 z = 5 y = 2 p = 3 

So, we can get x = 1, z = 5, y = 2, p = 3 or z = 5, p = 3, x = 1, y = 2. But the important thing is that p can only be executed after z is executed and etc., right?

How about a causal sequence? I do not see any difference here. Any thumbnails, or code in JAVA or C, would be great. Thanks.

+4
source share
1 answer

In sequential consistency, all memory operations appear so that all nodes appear in some order.

So, in your example, processes 1, 2, and 3 will see memory operations in the same order. (There are 6 possible orders for 4 operations, but all processes are consistent with what the order is.)

In a causal sequence, processes 1, 2, and 3 could observe how these records occur in different orders. There are two rules:

  • Everyone agrees that the process that I wrote happened in the same order as the process that I did.
  • If any process, i, reads the location x and gets the value written by another process, j, then all threads agree that process j is written to location x, which precedes the process that I read about location x.

Since there are no read operations in your original example, it is possible, for example, for process 1 to assume that the records occurred in the order x=1, y=2, z=5, p=3 , and process 2 considers that the records occurred in order z=5, p=3, x=1, y=2 and process 3 considers that they occurred in order z=5, x=1, p=3, y=2 .

The document on the Wikipedia page points to some examples that are more interesting (including readings).

Causal memory alone does not seem very useful. Later in the article, they show how to implement something like a barrier with causal memory (and an auxiliary process), but mention that there seems to be no convenient way to implement the critical section.

In this way, they ultimately accomplish what weakly harmonizes or releases consistent memories, and adds a synchronization primitive that should be consistent.

+3
source

Source: https://habr.com/ru/post/1484537/


All Articles