|
Boost : |
From: Chris Thomasson (cristom_at_[hidden])
Date: 2006-10-24 13:42:02
"Anthony Williams" <anthony_w.geo_at_[hidden]> wrote in message
news:zmbl66cr.fsf_at_yahoo.com...
> "Chris Thomasson" <cristom_at_[hidden]> writes:
>> "Anthony Williams" <anthony_w.geo_at_[hidden]> wrote in message
>> news:d58h7nlv.fsf_at_yahoo.com...
>>> The way I see it, the ideal is that a waiting writer will block any
>>> fresh
>>> readers until all the current readers have gone away, but once that
>>> happens,
>>> and the lock is released, the waiting writer and the waiting readers
>>> will
>>> compete equally.
[...]
>> Again, if your rw-mutex is getting hit with enough writes to even begin
>> to
>> start to starve the readers, then the user of the rw-mutex is using it
>> improperly... IMHO of course...
>
> I agree that preventing writers starving should be sufficient in most
> cases. I
> just happen to think that it's less than ideal.
>
> I was imagining a system with several hundred readers, and a couple of
> writers. If the writers take sufficiently long, you might find that you
> have
> one waiting on the other. The readers then get starved if you give writers
> priority, just as the writers get starved if you give readers priority.
Well, if you are using hundreds of reader threads, then basically any
rw-mutex is less than ideal in most cases, IMO:
http://groups.google.com/group/comp.programming.threads/msg/fdc665e616176dce
Humm...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk