Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11798: Implementation of boost::shared_mutex on POSIX is suboptimal
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-18 17:16:17
#11798: Implementation of boost::shared_mutex on POSIX is suboptimal
-------------------------+-------------------------------------------------
Reporter: alex@⦠| Owner: viboes
Type: Tasks | Status: assigned
Milestone: To Be | Component: thread
Determined | Severity: Optimization
Version: Boost | Keywords: pthread shared_mutex performance
1.59.0 | concurrency spinlock
Resolution: |
-------------------------+-------------------------------------------------
Comment (by Max <silverhammermba@â¦>):
I think I just ran into this bug with this repo:
https://github.com/silverhammermba/sanity
Basically I'm timing how long it takes a bunch of threads to do concurrent
reads on a std::unordered_map. In one case the reads are protected by
std::lock_guard<std::mutex>, so each thread has to wait its turn. In the
other case, the reads are protected by
boost::shared_lock<boost::shared_mutex>, so other than checking in with
the shared_mutex the reads should be concurrent.
One would think this is the ideal use-case for a shared lock: lots of
reads, no writes. But on my Arch Linux box the shared_lock version is
'''almost twice as slow''' as a naive mutex. My friend compiled the same
code on Windows and saw the exact opposite, with shared_lock being almost
twice as fast (as we would hope).
This is not just a matter of optimization, '''this makes
boost::shared_mutex completely useless on Linux'''. Please upgrade the
severity of this report.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11798#comment:8> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC