[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: another try at multithreading
- From: Ignacio Burgueño <ignaciob@...>
- Date: Wed, 25 Jun 2008 10:21:11 -0300
Javier Guerra Giraldez wrote:
On Tuesday 24 June 2008, Jérôme Vuarand wrote:
That is quite an interesting thread, though I'd like to come back to a
point that has been discarded too quickly in my opinion.
2008/6/19 Javier Guerra <firstname.lastname@example.org>:
An obvious improvement might be to use finer locks, maybe one per
mutable object; but a pthread mutex lock weights between 40 and 64
bytes each. way too much. readers/writer locks are even bigger.
this days i've been reading about lock implementations, and found this
(http://people.redhat.com/drepper/futex.pdf), reimplemented in C i get 4 byte
locks, and first tests show that could also work at 1byte. they're also
noticeably faster than pthread locks, especially in the non-contented case
(up to 60-70% faster).
the non-contented case is interesting, because since they're totally userspace
in this case (only call the kernel if the lock is contented), and using a
lock per object means a lot less contentions and higher opportunity for
Interesting. It works like critical sections on Windows, but taking 6
times less space (a CS in Windows takes 24 bytes).
Thanks for the link.