News for hackers. Stuff that matters.
Re:Why scaling and parallelism remain hard even with new too... by stcredzero on Wednesday August 10, 2016 @12:02PM (#12262738)
Also, our current hardware has no good mechanism for low overhead/latency communication between threads running on different cores. Instead, HFT programmers have to hack something together like Disruptor and insert unused arrays of longint to prevent false sharing.
Re:Why scaling and parallelism remain hard even with new too... by zzzcpan on Wednesday August 10, 2016 @12:53PM (#12263169)
I think the hardware is ok, it's just that most programmers are not that good at writing software on that level. Running an event loop per core and amortizing synchronization is not a rocket science.
Re:Why scaling and parallelism remain hard even with new too... by stcredzero on Wednesday August 10, 2016 @03:53PM (#12264373)
I think the hardware is ok, it's just that most programmers are not that good at writing software on that level.

If it becomes the case that the hardware has changed in such a way that most programmers now have a hard time writing code that compiles efficiently to it, the hardware has changed in the wrong way! Well, that is the case over the past few decades! Hardware has changed in the wrong way.

Re:Why scaling and parallelism remain hard even with new too... by di4na on Thursday August 11, 2016 @04:33AM (#12266887)
Or the compilers we use did not evolved... which mean language have not evolved...
Re:Why scaling and parallelism remain hard even with new too... by stcredzero on Thursday August 11, 2016 @01:04PM (#12269906)
I read it as closer to "640k ought to be enough for anyone" than simply having features in a language/compiler. C'mon, if you're inserting unused stuff into structures to get stuff on separate cache lines, something is a little too hacky here!
Re:Why scaling and parallelism remain hard even with new too... by CyberDildonics on Wednesday August 10, 2016 @01:15PM (#12263319)
> Also, our current hardware has no good mechanism for low overhead/latency communication between threads running on different cores

What is wrong with shared memory? Also if HFT programmers can do it, wouldn't that imply that the hardware can do it?

Re:Why scaling and parallelism remain hard even with new too... by millstone on Wednesday August 10, 2016 @02:57PM (#12264017)
Here's an illustration; this may be somewhat dated (not sure how this works with e.g. shared L3 caches) but it should give you a flavor of why shared memory sucks for messaging.

Consider the simplest example of a busy-loop, which is likely close to the fastest you can get. Core1 sends a message to Core2 by writing to an address that Core2 is repeatedly reading from.

Core1 first has to gain exclusive access to the address, by broadcasting an invalidate on the bus. Core2 thus discards its cache line. Next Core1 writes to the address by modifying the data in its L1 cache (or store buffer or worse). Core2 then reads from the address. Since Core1 holds the modified cache line, it is required to snoop the read. Core1 tells Core2 to wait and then retry. This happens repeatedly until Core1's write lands in main memory. Now Core2 can read the memory.

So:

1. Messaging requires a round trip to memory, a bunch of cache line invalidation, and other nonsense. Messaging involves multiple transitions to and from shared state.

2. Your CPUs already have a very fast message bus to implement MESI, but it is unavailable to you as a client programmer.

It should be obvious from this that we could build a much faster CPU messaging architecture if we cared to.

Re:Why scaling and parallelism remain hard even with new too... by pcwalton on Wednesday August 10, 2016 @09:21PM (#12265784)
x86 CPUs use MESIF or MOESI, not MESI. Those protocols don't require round trips to main memory.
Re:Why scaling and parallelism remain hard even with new too... by infinite8s on Wednesday August 10, 2016 @07:41PM (#12265453)
They can do it only by understanding the limitations of the underlying hardware - ie slots as big as a cache line to avoid false sharing, power of 2 ring buffer size to for fast slot calculation, etc.
Re:Why scaling and parallelism remain hard even with new too... by pcwalton on Wednesday August 10, 2016 @01:21PM (#12263367)
> Also, our current hardware has no good mechanism for low overhead/latency communication between threads running on different cores.

Shared memory is extremely fast on modern x86.

Re:Why scaling and parallelism remain hard even with new too... by hyperpape on Wednesday August 10, 2016 @05:09PM (#12264774)
Is millstone wrong, or are y'all just using different definitions? https://news.ycombinator.com/item?id=12264017
Re:Why scaling and parallelism remain hard even with new too... by Jweb_Guru on Wednesday August 10, 2016 @11:14PM (#12266126)
Millstone is wrong (and pcwalton explained why).
Re:Why scaling and parallelism remain hard even with new too... by marcosdumay on Wednesday August 10, 2016 @01:27PM (#12263410)
It is also full of synchronization problems. Both for the layer above and bellow it.

Hardware message interfaces would go a good deal into improving the situation.

Re:Why scaling and parallelism remain hard even with new too... by jandrese on Wednesday August 10, 2016 @02:19PM (#12263771)
It comes down to cache invalidation, which is one of the Hard Problems of computer science.
Re:Why scaling and parallelism remain hard even with new too... by marcosdumay on Wednesday August 10, 2016 @02:35PM (#12263882)
But it's much better if you only have to deal with it in software, only when it's strictly needed.

Currently, we just turn any random problem into a cache invalidation one, and hope it makes our life easier.