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

BigInteger's staticRandom field can be a source of bottlenecks.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b113
    • CPU:
      generic
    • OS:
      generic

      Description

      This is a SUNBUG for https://bugs.openjdk.java.net/show_bug.cgi?id=100218

      See also these references:

      http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-January/009176.html
      http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-January/008880.html

      Description

      Created an attachment (id=251) [details]
      hg diff -g of BigInteger.java

      The static field 'staticRandom' in BigInteger can be a source of bottlenecks
      for concurrent code. This can be seen by calling isProbablePrime from several
      threads running in parallel and noting that there is no appreciable speedup
      over running linearly.

      The proposed fix is change the static volatile staticRandom field to a
      ThreadLocal. This will allow each thread to hold their own copy of staticRandom
      and not have to wait for other threads when trying to access it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                tbell Tim Bell
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: