
1 Dec
2009
1 Dec
'09
4:11 p.m.
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.