Boost logo

Boost :

Subject: Re: [boost] [fiber] new version in vault
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-12-01 11:11:34


Stefan Strasser wrote:
> why would you want to use hashed mutexes when you can implement a mutex in the
> size of a reference into a mutex table?

Say I have:

uint16_t counters[1000000];

If I want to use those counters from two threads I could pair each one
with a mutex. With some thought I might be able to do that with just
one bit per counter, but that's still 125 kbytes. Or, I could have 13
mutexes and hash from counter i to mutex i%13; even with a 24-byte
pthread_mutex that's only 312 bytes.

Phil.


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