[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming

I have just read this from Martin Thompson

Ramine

5/10/2016 2:44:00 AM



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


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.c...!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.