RFR: 8291714: Implement a Multi-Reader Single-Writer mutex for Hotspot

Kim Barrett kbarrett at openjdk.org
Fri Aug 19 00:07:38 UTC 2022


On Thu, 18 Aug 2022 20:24:26 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> For some reason, I can't believe that we don't have this feature already in the vm, or at least, I was expecting this to be a simple wrapper over globalCounter.hpp. Or SingleWriterSynchronizer.hpp (whose name I can say). If it's the same as the ZGC version, maybe the ZGC version should be moved or reconciled in the utilities directory.

GlobalCounter and SingleWriterSynchronizer are RCU mechanisms. While there are
some similarities in use-cases, RCU is not equivalent to a shared mutex. I
think there are use-cases for shared mutex that aren't appropriate (or even
feasible?) for RCU. My impression is this came up because UL has its own
attempt at an RCU mechanism that is broken in both implementation and usage.
(That's my 2nd-hand impression; I've not really looked at it.) One solution
would be to change UL to use one of our other RCU mechanisms and fix any usage
problems. Another is to introduce a shared mutex and use that.  Generational
ZGC has a shared mutex to deal with a specific use-case, and this PR is
proposing to generalize that.

-------------

PR: https://git.openjdk.org/jdk/pull/9838


More information about the hotspot-dev mailing list