This is the mail archive of the
mailing list for the glibc project.
Re: Synchronizing auxiliary mutex data
On Tue, 2017-06-20 at 16:49 +0200, Andreas Schwab wrote:
> On Jun 20 2017, Torvald Riegel <email@example.com> wrote:
> > On Tue, 2017-06-20 at 15:55 +0200, Andreas Schwab wrote:
> >> On Jun 20 2017, Torvald Riegel <firstname.lastname@example.org> wrote:
> >> > On Tue, 2017-06-20 at 15:40 +0200, Andreas Schwab wrote:
> >> >> On Jun 20 2017, Torvald Riegel <email@example.com> wrote:
> >> >>
> >> >> > I described exactly that above. It is guaranteed for the code above by
> >> >> > the memory model. Implementations of the memory model (so in our case,
> >> >> > the compiler and the HW) have to ensure that. For example, in the x86
> >> >> > memory model, acquire and release MO are implicit, so because the
> >> >> > compiler is not allowed to reorder in this case, the HW ensures that
> >> >> > lock()'s write to owner happens after unlock's write to owner.
> >> >>
> >> >> What about the read in the locking thread?
> >> >
> >> > I have answered that in my previous emails.
> >> What does prevent the cpu from loading it from its cache?
> > The correct implementation of the memory model does that.
> That's not a useful answer.
It is a correct answer, and a good starting point for you to understand
that because this all starts with understanding the memory model that
you're programming against, which is effectively C11's. And I already
explained which specific part of the memory model is being used by glibc
in this case (ie, rel/acq pair + reads-from =>
inter-thread-happens-before). And I told you how you can find out what
happens on the lower layers of this (eg, the HW memory model). If you
don't follow up on all that information, what am I supposed to do?
Furthermore, have you looked at your own set of questions? I had to
guess all the time what you are actually asking about. Take your most
recent statement above as example: You don't even care to say why it
was not helpful for you. Am I supposed to guess why it was? I meant it
when I said that I don't have time for a one-liner exchange. They way
in which you often communicate (ie, those one-liners) is no effective,