I have two questions:
I would like to know if the standards for C++11 and C11 will share the same memory model specs. I read that this is so, that in fact C11 is "inheriting" the C++11 memory model (for whatever historical reasons the latter happened either first or at the same time/with the same people, though I think Boehm, who's a C++ guy primarily, had a lot to say.) , but I'd like to make sure asking someone more knowledgeable.
My next question is: will GCC ever implement this memory model at all? I haven't seen the roadmap for this, and was wondering if someone had a "scoop".
C++11 Memory Model. A memory model, a.k.a memory consistency model, is a specification of the allowed behavior of multithreaded programs executing with shared memory [1].
C's memory model provides something like a unique location for (almost) all objects through the & operator, and that location can be accessed and modified from different parts of the program through pointers.
The memory model stipulates that changes to the values of shared variables only need to be made visible to other threads when such a synchronization barrier is reached. Moreover, the entire notion of a race condition is defined over the order of operations with respect to these memory barriers.
A memory model is a way of organizing and defining how memory behaves. It provides a structure and a set of rules for you to follow when you configure how addresses, or regions of addresses, are accessed and used in your system.
The memory model was developed for C++11, and adopted by C11. Lawrence Crowl did a lot of work to ensure that the interface for atomic operations was as close as possible. There were quite a few people involved, but you are right that Hans Boehm was one of them.
GCC currently (4.7) implements a reasonable approximation of the memory model. Certainly close enough that most programs won't be able tell the difference. I'm fairly sure that full conformance is on their plan, but don't know the timetable, as I'm not involved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With