2 ms·
"C/C++ language designers used to take the position that concurrency was an OS issue, not a language issue" That was the case until Bohem's 'Threads Cannot be
by gpderetta 11y ago
"C/C++ language designers used to take the position that concurrency was an OS issue, not a language issue"
That was the case until Bohem's 'Threads Cannot be Implemented as a Library' position paper, which lead the C++ Standard Committee to formally define the C++ memory model (whose correctness was also independently proven [1]). This standardization work was greatly inspired by the corresponding Java MM, and in a break from the past, it explicitly disallowed a few compiler optimizations and even made the C++ standard unimplementable on a few quirky older architectures for the sake of sanity.
Today there are no arguments on whether a concurrent algorithm (and compiler optimizations) is conforming or not, as there are both dynamic and static checkers that can verify it against the C++ memory model.
I wish that the same rigorous formalization work were to be done for the strict aliasing rules of the language, which are still a mess of underspecified, ambiguous and mutually contradicting rules scattered all over the standard document.
[1] the original drafts had in fact issues which were found when attempting the correctness proof; these flaws have been corrected, except there is a still standing issue with out-of-thin-air values; it is not believed to have any impact on code with current compiler and cpus, but there is an ongoing effort to correct it.