Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8216258

Make FreeIdSet semaphore-based

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 13
    • Component/s: hotspot
    • Subcomponent:
      gc
    • Resolved In Build:
      b06
    • CPU:
      generic
    • OS:
      generic

      Description

      The FreeIdSet currently uses a monitor to protect its data structure manipulations and to wait/notify when more threads want to allocate an id than there are available. Worse, the notification is a notify_all. Even worse, the monitor used is the CBL monitor, so locking here contends with CBL enqueue/get.

      A different approach would be to use a counting semaphore to control access to the set. That's a more natural approach, but couldn't be done when the FreeIdSet was developed because we didn't have an API for semaphores then. Also need to make the id set manipulation lock free. That can be done by making the "head" value a pair of bit fields, the next available index and an update counter. The update counter is incremented on each change of head, so solve the ABA problem.

        Attachments

          Activity

            People

            • Assignee:
              kbarrett Kim Barrett
              Reporter:
              kbarrett Kim Barrett
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: