Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11975

Remove full barriers in thread creation and join code

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • StorEng - Defined Pipeline

      We currently use full barriers before launching a thread and after joining one. The comments say that this is because the APIs don't guarantee them and we want the new thread to be able to see all writes from before its creation, and the joiner thread to see all writes from the joinee. While the comments are correct that the synchronization guarantees are unclear in the platform-specific thread functions (a general problem in those APIs), the C++ spec makes it very explicit for both create, and join. I checked the C++ stdlib implementations and they are using the same functions we are without any fencing, so we are fine. And from a rational level, basically nothing would work without that synchronization.

      Note that those functions only provide acquire/release semantics not full barriers, so code like the following can't rely on all memory accesses in a() being strongly ordered with accesses in b(), although it would be very unusual for code to rely on that, so it should be made explicit if it is.

      a();
      __wt_thread_create(...);
      b();
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: