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

I have just read this from Martin Thompson

4 views
Skip to first unread message

Ramine

unread,
May 9, 2016, 7:40: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.
0 new messages