|The Case For 64-bit Futexes
||[Jan. 12th, 2007|03:41 pm]
There are currently patches to implement 64-bit futexes floating around. So far, futexes are limited to 32 bits, regardless of platform. The new code will implement 64-bit futexes for 64-bit platforms. That's possible for all 64-bit architectures which can implement futexes in the first place. People were wondering why this code is needed. PIDs are not going to be extended.|
Here is one reason: I have a new reader/writer lock implementation which is a whole lot faster. But to be general enough to replace the existing code in libpthread it needs 64-bit futexes. Does it matter? Here are the measurements, judge yourself.
This is an extreme case but something customers report as being quite close to frequent cases. Here only readers are used and they do nothing but take a lock, do some memory intensive work, unlock, and repeat. The graphs show the speed-up when adding more threads. The measurements are done on a UP quad core machine.
For the old code any number of threads greater than one loses. With the new implementation we can achieve about 50% speed-up when using more threads. It seems three threads is about the sweat spot. This is of course a detail of this specific test. Regardless, suddenly throwing threads at the problem yields better results and this is of course good news given that we'll see more and more cores.