For many reasons:
- I'm using the SPSC bounded queue approach since many years in my audio software stuff for as sound ringbuffer between two on-different-CPU-cores-pinned threads without any issues. And the SPSC boundung queue is really simple, because only one thread can be a producer and only one another thread can be a consumer. And the C++ boost::lockfree ringbuffer class seems using the same (or a very similar) SPSC bounded queue approach like I myself. Only the critical part is that the memory barriers are set correctly on the correct code positions, especially on CPU targets with weak memory models (for example ARM, PowerPC, etc.). x86 CPUs have comparatively a strong memory model. For more about weak vs. strong memory models, see: http://preshing.com/20120930/weak-vs...memory-models/
- The lock-free MPMC queue stuff is based on the http://people.csail.mit.edu/edya/pub...ue-journal.pdf paper, which contains a "Correctness proof" text section.
- The lock-free MPMC stack stuff is is based on the idea behind the concept of the internal workings of the "Interlocked Singly Linked Lists" Windows API, just stripped by the Depth stuff, which (the core concept behind it) is also well tested at the Microsoft Windows Operating System.
- The lock-free job work stealing is based on http://www.di.ens.fr/~zappa/readings/ppopp13.pdf, which contains also a "Correctness proof" text section.
And you have to consider the problem with the CPU cache lines for to avoid the false-sharing performance-degrade issues (https://en.wikipedia.org/wiki/False_sharing). Therefore, PasMP is more optimized for performance than for the memory usage, because almost everything in PasMP is CPU cache line aligned, also every item in your TPasMPDynamicArray, TPasMPBoundedStack, TPasMPBoundedQueue, etc. And a CPU cache line is on the most current x86 CPUs 64 bytes long.
Bookmarks