Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-24 14:34:30

Ion Gaztañaga wrote:
> For what I've seen in code, read_write_mutex has a lot of options
> regarding reader/writer priorities and for that uses conditions and
> mutexes to offer that functionality. The overhead is bigger than
> mutexes, but I think the critical section you have chosen is very
> small, and where read_writer_mutex shines is when you have to lock
> expensive operations (lookups for example, in data-bases) with lots of
> readers. In that case, a mutex would
> serialize all, but read_writer_mutex would allow concurrent
> readers.

Yes. However my suspicion is that read/write locks only speed up code that
has been written in an inefficient (MT-unfriendly) way. For high
performance, critical regions need to be as small and quick as possible, and
read/write locks appear to target the case where the critical regions are
relatively large and slow.

Boost list run by bdawes at, gregod at, cpdaniel at, john at