Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-10-31 01:45:08


Peter Dimov wrote:
> In my opinion, we only need to do one version, and do it right.

I am not yet convinced.

Altough Wikipedia is not a citable resource:
http://en.wikipedia.org/wiki/Readers-writers_problem

Butenhof's example in "Programming with Posix Threads".

Bill Kempfs Implementation.

Several sites I looked up in the net.

I really would like to ask: How is the problem teached
in schools? E.g. in an operating systems course?

> The problem in this case is that a rwlock is almost purely a performance
> optimization. It is generally not used for its semantics (although I can
> imagine a few use cases for them); a mutex is replaced with a rwlock in an
> attempt to increase reader performance, preferably without slowing down
> writers to a standstill.

???

Sorry I absolutely cannot understand the previous.
A pure performance optimization? I always thought
it was mainly used because of its semantics: You
are letting multiple readers access at the same
time: This is the main source of performance gain.

Of course, if you are measuring threads, that do no
operations while holding the lock, you will measure
the price of the lock implementation. However if you
are doing substantial calculation while holding the
lock I am almsot sure that this will be a win, even
with the "emulated" rw-lock.

> Viewed in this light, a read/write mutex that is slower than an ordinary
> mutex for the typical use cases is - IMO - not really worth having in the
> library.

I am still not convinced. What are the typical cases?
Couild you possibly come up with examples?

> We've never wanted a broken version of any component in any release. :-)

Ok second vote to remove it. (Mine first. ;-)

Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk