memory-model Questions
1
OpenCL and CUDA have included atomic operations for several years now (although obviously not every CUDA or OpenCL device supports these). But - my question is about the possibility of "living with...
Pavel asked 2/7, 2016 at 15:44
2
Solved
I'm worried about the correctness of the seemingly-standard pre-C#6 pattern for firing an event:
EventHandler localCopy = SomeEvent;
if (localCopy != null)
localCopy(this, args);
I've read Eric...
Caitiff asked 11/5, 2016 at 20:50
5
Solved
In C and C++ a variable can be marked as volatile, which means the compiler will not optimize it because it may be modified external to the declaring object. Is there an equivalent in Delphi progra...
Palette asked 24/10, 2008 at 0:16
2
Solved
What do you think is the best correct way for implementing the acquire part of a release/acquire pair in Java?
I'm trying to model some of the actions in an application of mine using classic relea...
Bookbinder asked 8/5, 2016 at 22:14
1
Solved
Is the following code standards compliant? (or can it be made compliant without making x atomic or volatile?)
This is similar to an earlier question, however I would like a citation to the relevan...
Llamas asked 7/2, 2016 at 13:37
2
Solved
Consider the C++ 11 snippet below. For GCC and clang this compiles to two (sequentially consistent) loads of foo. (Editor's note: compilers do not optimize atomics, see this Q&A for more detail...
Eyla asked 14/10, 2015 at 14:22
4
The C++11 standard defines a memory model (1.7, 1.10) which contains memory orderings, which are, roughly, "sequentially-consistent", "acquire", "consume", "release", and "relaxed". Equally roughly...
Ender asked 26/10, 2013 at 17:54
2
Java's memory model is based on "happens-before" relationship that enforces rules but also allows for optimization in the virtual machine's implementation in terms of cache invalidation.
For exam...
Womanize asked 29/9, 2015 at 13:50
2
Solved
Java provides a Lock object in the concurrency package that according to the documentation provides more extensive locking operations than can be obtained using synchronized methods and statements....
Barbuto asked 30/9, 2015 at 10:13
4
Solved
It is known that, unlike Java's volatiles, .NET's ones allow reordering of volatile writes with the following volatile reads from another location. When it is a problem MemoryBarier is recommended ...
Fates asked 15/5, 2013 at 18:34
5
Solved
I was reading Bjarne Stroustrup's C++11 FAQ and I'm having trouble understanding an example in the memory model section.
He gives the following code snippet:
// start with x==0 and y==0
if (x) y ...
Anthropomorphism asked 1/1, 2014 at 17:11
5
Solved
In C#, this is the standard code for invoking an event in a thread-safe way:
var handler = SomethingHappened;
if(handler != null)
handler(this, e);
Where, potentially on another thread, the com...
Ahoufe asked 10/6, 2015 at 14:48
2
Solved
I have a question regarding a GCC-Wiki article. Under the headline "Overall Summary" the following code example is given:
Thread 1:
y.store (20);
x.store (10);
Thread 2:
if (x.load() == ...
Osi asked 13/8, 2015 at 16:16
2
Solved
Suppose I have a member variable in a class (with atomic read/write data type):
bool m_Done = false;
And later I create a task to set it to true:
Task.Run(() => m_Done = true);
I don't car...
Necessitate asked 6/6, 2015 at 0:30
2
I'm not sure i fully understand (and i may have all wrong) the concepts of atomicity and memory ordering in C++11.
Let's take this simple example single threaded :
int main()
{
std::atomic<int...
Jilolo asked 16/4, 2015 at 8:48
2
Solved
According to this https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html,
a released store is implemented as MOV (into memory) on x86 (including x86-64).
According to his http://en.cppreference.co...
Overkill asked 28/4, 2015 at 14:56
1
Solved
What is the minimal framing required for x's type for this code to work, considering the implied synchronization when creating/joining a thread: std::atomic? volatile? nothing?
#include <thread...
Farceur asked 16/4, 2015 at 19:34
3
Solved
According to wikipedia: A memory barrier, also known as a membar, memory fence or fence instruction, is a type of barrier instruction that causes a central processing unit (CPU) or compiler to enfo...
Monosyllable asked 8/4, 2015 at 16:7
2
Solved
Can somebody who understand the Java Memory Model better than me confirm my understanding that the following code is correctly synchronized?
class Foo {
private final Bar bar;
Foo() {
this.bar...
Axon asked 26/3, 2015 at 4:36
4
I'm watching this video by Herb Sutter on GPGPU and the new C++ AMP library. He is talking about memory models and mentions Weak Memory Models and then Strong Memory Models and I think he's referri...
Snath asked 27/8, 2011 at 13:42
5
Solved
Suppose we have a volatile int a. One thread does
while (true) {
a = 1;
a = 0;
}
and another thread does
while (true) {
System.out.println(a+a);
}
Now, would it be illegal for a JIT compil...
Augusto asked 19/12, 2014 at 13:15
2
Solved
My question involves std::atomic<T*> and the data that this pointer points to. If in thread 1 I have
Object A;
std:atomic<Object*> ptr;
int bar = 2;
A.foo = 4; //foo is an int;
ptr.stor...
Sining asked 6/11, 2014 at 18:45
1
Solved
I have a question regarding the Java Memory Model. Given the following example:
action 1
action 2
synchronized(monitorObject) { //acquire
action 3
} //release
action 4
acquire and release can b...
Whirligig asked 3/11, 2014 at 22:27
3
Solved
The Intel 64 and IA-32 Architectures Software Developer's Manual says the
following about re-ordering of actions by a single processor (Section 8.2.2,
"Memory Ordering in P6 and More Recent Process...
Melena asked 12/6, 2014 at 4:46
4
Solved
I have immutable objects whose hashcode I wish to calculate lazily. I've implemented
private bool _HasHashCode = false;
private int _HashCode;
public override int GetHashCode()
{
if (_HasHashCode...
Sammy asked 27/8, 2014 at 6:4
© 2022 - 2024 — McMap. All rights reserved.