Results 1 to 8 of 8

Thread: PasMP - a parallel-processing/multi-processing library for Object Pascal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Quote Originally Posted by Mirage View Post
    Cool! This is exactly what I lacked in FPC!
    Thank you for sharing this!
    Are there any tests for the library?
    Or how did you know that your lock-free collections implementation are really thread safe and correct?
    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.
    Last edited by BeRo; 21-02-2016 at 10:23 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •