News for hackers. Stuff that matters.
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.