Linux driving C standards
Posted May 7, 2013 17:43 UTC (Tue) by ncm
Parent article: LFCS: The LLVMLinux project
It is almost as if the Linux kernel has been driving the C standards.
There is literal truth to this. Our own Paul McKenney was deeply involved in defining and standardizing a memory model that rigorously supports C++ multi-threading, for C++11. (Up until now all multi-threaded programs have relied on not-too-clever optimizers, the over-specified x86 memory bus, not-too-many cores, and luck.) The ISO C Standard committee adapted the C++ memory model for their own use, with compatible semantics. The Linux kernel benefits from the newly rigorous C memory model.
The x86 over-specified memory bus design makes interaction of threads on more than a few cores impractical, as the bus spends a growing fraction of its time keeping all the caches up to date, leaving less time for real work. The new C++ and C memory models relax some consistency requirements to make more parallelism practical, but that makes reasoning about shared memory in multi-threaded programs even trickier. (When core A writes to address P, when might core M see the new value there?) While the rules are now rigorous, they are also too hard for mere mortals with other interests to use correctly: clever shortcuts fail for reasons that are hard to explain. Ultimately, better languages will apply the rules implicitly. In the meantime, we must rely on higher-level abstractions and avoid reasonable-seeming shortcuts.
to post comments)