Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I have just read this from Martin Thompson

14 views
Skip to first unread message

Ramine

unread,
May 9, 2016, 7:41:45 PM5/9/16
to
Hello.....

I have just read this from Martin Thompson:

"Firstly, our compilers can generate programs that store variables in
registers for relatively long periods of time for performance reasons,
e.g. variables used repeatedly within a loop. If we need these
variables to be visible across cores then the updates must not be
register allocated. This is achieved in C by qualifying a variable as
"volatile". Beware that C/C++ volatile is inadequate for telling the
compiler to order other instructions. For this you need fences/barriers."

read more here:

https://dzone.com/articles/cpu-cache-flushing-fallacy


So i think that a necessary and sufficient condition so that
the variable be visible accross cores is to qualify
a variable as "volatile".

So i don't think that Dmitry Vyukov is right to add the windows function
called FlushProcessWriteBuffers() when he wrote this:

https://groups.google.com/forum/#!topic/lock-free/Hv3GUlccYTc


I don't think this algorithm of Dmitry Vyukov needs
FlushProcessWriteBuffers(), because it already has declared the
necessary variable as "volatile".


Thank you,
Amine Moulay Ramdane.

Mr Flibble

unread,
May 10, 2016, 1:27:00 PM5/10/16
to
On 10/05/2016 03:45, Ramine wrote:
> Hello.....
>
> I have just read this from Martin Thompson:
>
> "Firstly, our compilers can generate programs that store variables in
> registers for relatively long periods of time for performance reasons,
> e.g. variables used repeatedly within a loop. If we need these
> variables to be visible across cores then the updates must not be
> register allocated. This is achieved in C by qualifying a variable as
> "volatile". Beware that C/C++ volatile is inadequate for telling the
> compiler to order other instructions. For this you need fences/barriers."
>
> read more here:
>
> https://dzone.com/articles/cpu-cache-flushing-fallacy
>
>
> So i think that a necessary and sufficient condition so that
> the variable be visible accross cores is to qualify
> a variable as "volatile".

You would be wrong to do that as that is not what the volatile keyword
is for.

/Flibble


Ian Collins

unread,
May 10, 2016, 4:13:02 PM5/10/16
to
On 05/11/16 05:26 AM, Mr Flibble wrote:
> On 10/05/2016 03:45, Ramine wrote:

Please don't reply to Ramine spam!

--
Ian Collins
0 new messages