News for hackers. Stuff that matters.

madanMus

Re:The Silently Shifting Semicolon [pdf] on Tuesday April 14, 2015 @07:09PM (#9377914)
yes, you did read correctly. The 1-3% does assume a non-standard whole-program analysis. Something more practical on existing hardware will look more like the E numbers (for escape analysis): 17.5% on x86 and 6.8% on ARM. An even dumber analysis (H) adds up to 37.5% overhead on x86.

It is important to realize that the overhead numbers are not huge, like 5x or 20x, to simply write SC off.

As we say in the paper, these overheads, however small they might be, will be unacceptable for low-level libraries written in C/C++ programs. The main argument of the paper was that these overheads are acceptable for "safe" languages like Java/C# which anyway add other (useful) overheads such as garbage collection, bounds checking etc. to help out the programmer.

Even for C/C++, it will still make sense to have SC by default - the programmer is responsible for explicitly turning off SC semantics in parts of the code where the inserted fences hurts performance. This is a much better tradeoff - safe by default and performance by choice.

Re:The Silently Shifting Semicolon [pdf] on Tuesday April 14, 2015 @03:22AM (#9372603)
Yes, it does, provided programmers restrict themselves to the safe subset of the language. Rust is a wonderful step in the right direction.
Re:The Silently Shifting Semicolon [pdf] on Tuesday April 14, 2015 @03:21AM (#9372599)
[I am one of the authors of the paper.]

The paper reports overhead numbers from existing research. For instance, see Figure 18 in http://arxiv.org/abs/1312.1411, which shows the cost of SC for memcached - 1% on x86 and 3% on ARM.

This overhead is primarily due to the cost of fences on existing hardware. What we (not so cheekily) say is this is likely to get better as hardware platforms provide better implementations for fences.

Re:The Silently Shifting Semicolon [pdf] on Tuesday April 14, 2015 @02:58AM (#9372526)
But the math is currently broken for Java. See http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.112....

Here the authors show that most common compiler optimizations are JMM incompatible.

Re:The Silently Shifting Semicolon [pdf] on Tuesday April 14, 2015 @02:54AM (#9372511)
The article does not ignore architectures like ARM. You do need fences, but not all the time - the compiler can avoid fences in places where there is no danger of violating sequential consistency (e.g. on accesses to provably local objects).