Re: coherence litmus test and data race.

Alex Otenko via Concurrency-interest <[email protected]> Tue, 13 Jul 2021 15:07:56 +0100
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <CANkgWKjnVJRo0uNc_3woobKUj+7ztFzQqxOrf_D40-sNX3WzBA@mail.gmail.com>
I think the only requirement for plain loads in a concurrent setting is
that there are no out-of-thin-air values.

That is, you can read only values that some thread stores.

The coherence does not come into picture, because there is a compiler
(which is allowed to produce code that violates any assumptions you want to
make about hardware)

Alex

On Tue, 13 Jul 2021, 08:18 Peter Veentjer via Concurrency-interest, <
[email protected]> wrote:

> 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
>

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