samedi 25 juin 2016

Does the C++11 standard formally define acquire, release, and consume operations?


In the C++11 standard, section 1.10/5 mentions, but does not formally define the terms acquire operation, release operation, and consume operation. It then goes on in Section 29 to use these terms to describe the actions of certain memory orderings, atomic operations, and memory fences. For instance, 29.3/1 on "Order and Consistency" states:

memory_order_release, memory_order_acq_rel, and memory_order_seq_cst: a store operation performs a release operation [emphasis added] on the affected memory location.

This type of language is repeated throughout section 29, but it bothers me a bit that all meanings for the memory_order enumerations are based on operation types that themselves do not seem to be formalized by the standard, yet must have some commonly agreed-to meaning for them to be effective as definitions.

Put a different way, if I said "A bar is a flipped foo", the concrete meaning of bar and foo are ambiguous since neither term is formally defined. Only their relative natures are defined.

Does the C++11 standard, or some other C++11 standards committee document formally define what exactly an acquire operation, release operation, etc. is, or are these simply commonly understood terms? If the latter, is there a good reference that is considered an industry standard for the meaning of these operations? I specifically ask because hardware memory consistency models are not created equal, and therefore I'm figuring there must be some commonly agreed-to reference that allows those implementing compilers, etc. to properly translate the semantics of these operations into native assembly commands.


Aucun commentaire:

Enregistrer un commentaire