PinkElephantsOnParade
PinkElephantsOnParade

Reputation: 6592

Strict Consistency versus Sequential

I don't understand these. Let's say I have a value 10 at memory address x.

If we have

thread1:
Read(x)
x+=5
Write(x)

and then:

thread2:
Read(x)
x+=2
Write(x)

I don't get what is valid sequential or strict consistency.

Like, here, is this a valid strictly consistent operations result?

T1: R(x), found 10                W(x), x is now 15
T2                 R(x),found 10                     W(x), x is now 12

That seems so useless. x has the wrong value... it wasn't additive. That said, the accesses executed by each processor were kept in-order and the same order was seen by everyone. Those are the criterion for strict consistency, right? It doesn't matter that the result got crushed.

And for a sequential consistency... I don't get the distinction between it and strict.

Upvotes: 1

Views: 530

Answers (1)

KalyanS
KalyanS

Reputation: 527

Partially addressing your question:

Sequential consistency, just requires that the memory location sees operations in the order they were issued. From a master thread(clock) perspective, the way these operations were issued may not be desirable.

But, they are still sequentially consistent. My own interpretation is that reordering the operations on the memory location after they were issued, will violate the consistency requirement. It is as if, a global ticket has been acquired at the time of issue and execution engine honors the ordering of tickets.

The "problem", if we can call that, is with the instruction issue itself - in that T1 and T2 are free to issue them in any order. If the application is happy with that level of consistency, it should happily use it.

A hypothetical situation: lets we would like some memory location to be updated by multiple threads and a reader after all threads completed must read the last written value - you only need the last one to win in the order they were issued. Of course, this is a narrow situation, but, a desirable one in certain cases.

Upvotes: 1

Related Questions