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

Kim Barrett kbarrett at openjdk.org
Tue Aug 16 18:55:12 UTC 2022


On Fri, 12 Aug 2022 04:44:51 GMT, David Holmes <dholmes at openjdk.org> wrote:

> > Multi-Reader Single-Writer mutex
> 
> Sorry to bikeshed but such a thing is called a ReadWriteLock or a ReadersWriterLock or something similar - can we please use familiar nomenclature here (even rwlock as per POSIX). "mutex" is a contraction of mutual-exclusion and as readers are not mutually exclusive it is an oxymoron to talk about a "multi-reader mutex". Thanks.

For what it's worth, C++ Standard Library uses "mutex" to refer to an object
that gets locked, and uses "lock" to refer to an RAII object that locks a
"mutex". So it has, for example, `std::shared_mutex`, which is
multi-reader/single-writer. The idea being that a "mutex" provides some kind
of mutual exclusion - in the case of shared_mutex readers (multiple) are
excluded from any writer, and writers are exclusive from each other. I'd
prefer that to calling these new things "locks".

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

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


More information about the hotspot-dev mailing list