coherence litmus test and data race.

Peter Veentjer via Concurrency-interest <[email protected]> Tue, 13 Jul 2021 10:16:11 +0300
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <CAGuAWdAARFsRsRf5zvmRbBcQbJJGN6BDV0x_3CPLBiUmvqYENQ@mail.gmail.com>
Hi,

Imagine the following program:

int a,b=0

thread1:
   a=1
   [storestore]
   a=2

thread2:
    r1=a
    r2=a

It is obvious that there is a data race since the loads/stores are plain
loads and stores. My question is about the allowed behaviors in this
particular case. Do the 2 plain loads to the same address need to be
executed in order, or will any order be fine?

In terms of litmus tests: is it allowed that code with a data race can
violate the coherence litmus test.

int a,b=0

thread1:
   a=1

thread2:
   a=2

thread3:
  r1=a
  r2=a

thread4:
   r3=a
   r4=a

So could it be that we end up with r1=1, r2=2, r3=2 and r4=1.

https://repository.upenn.edu/cgi/viewcontent.cgi?article=1980&context=cis_reports

My guess at this is allowed behavior because it doesn't change the 'within
thread as if serial semantics'.

Regards,

Peter.

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest