Sunday, March 19, 2017

Digest for comp.programming.threads@googlegroups.com - 1 update in 1 topic

Ramine <toto@toto.net>: Mar 18 10:44PM -0400

Hello...
 
 
I have just read this about the C++11 Memory Model:
 
Some programming languages offer SC in multiprocessor environment. In
C++11, you can declare all shared variables as C++11 atomic types with
default memory ordering constraints. In Java, you can mark all shared
variables as volatile [1] [2].
 
Because the C++11 atomic types guarantee sequential consistency, the
outcome r1 = r2 = 0 is impossible. To achieve this, the compiler outputs
additional instructions behind the scenes – typically memory fences
and/or RMW operations. Those additional instructions may make the
implementation less efficient compared to one where the programmer has
dealt with memory ordering directly.
 
Read here:
 
https://people.cs.pitt.edu/~xianeizhang/notes/cpp11_mem.html
 
So, there is still a problem with C++, because so it is still error
prone if you forget C++11 atomic types to ensure sequential consistency
and it is less efficient with atomic types.
 
 
So i still prefer Delphi and FreePascal that don't reorder loads and stores.
 
 
 
Thank you,
Amine Moulay Ramdane.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.programming.threads+unsubscribe@googlegroups.com.

No comments: