On 01/08/13 08:43, Andrew Haley wrote:

One random thought.  Linux x86 has very fast access to thread local
variables: it's just a segment prefix on a load instruction.  I wonder
if the JVM could utilize something like this and so improve
performance for thread locals that don't require non-null initial
values.

Thanks. Yes, I've had discussions with various people
over the years about somehow exploiting native thread-local
support for simple scalars. I don't think there is a great
scheme to be had here though. Problems include
(1) fixed arena sizes on some/most platforms.
(2) no good way to coordinate slot-grabbing with native uses
(3) no good way to relinquish
(4) no good emulation scheme for systems without support

But mostly: The space for "permanent" thread-locals
needs to be placed somewhere; why not choose the
place that presents the fewest logistics problems?
Note that class java.lang.Thread is only the visible
tip of the iceberg of per-thread storage on systems.
so adding 16bytes is all but undetectable.

-Doug

Reply via email to