RFR: 8296746: NativePRNG SecureRandom doesn't scale with threads [v2]
Daniel Jeliński
djelinski at openjdk.org
Thu Nov 17 09:39:26 UTC 2022
On Tue, 15 Nov 2022 20:46:43 GMT, Xubo Zhang <duke at openjdk.org> wrote:
>> Xubo Zhang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update src/java.base/unix/classes/sun/security/provider/NativePRNG.java
>>
>> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>
> Hi [XueleiFan](https://github.com/XueleiFan)
> This shouldn't be the case unless there is a kernel bug. Multiple threads using ThreadLocal to access /dev/random is just like multiple applications accessing it.
Hi @xbzhang99,
Could you explain the problem you are trying to solve?
Random number generation is usually just a tiny fraction of a larger algorithm, and the SecureRandom instance is rarely contended outside of microbenchmark setting. And if it's not contended, users will only pay the cost of using a ThreadLocal for no real benefit.
-------------
PR: https://git.openjdk.org/jdk/pull/11069
More information about the security-dev
mailing list