NVIDIA and TLS
Gareth Hughes
gareth at nvidia.com
Mon Jun 16 18:44:25 PDT 2003
On Mon, 16 Jun 2003, Alexander Kabaev wrote:
>
> That was very nice of them to develop a "standard" which penalises each
> and every threads implementation except pure kernel-based threads Linux
> happens to implement now.
>
> Said that, I think FreeBSD will have to follow the suit sooner or later.
> When the mass of Linux software using TLS reaches certain level, we'll
> be unable to ignore its requirements. It is sad though that we'll have
> to give up a some of our performance optimizations.
No, this is simply not true.
If your thread library implementation is that much better than
anything else out there, simply support the dynamic access models
(General Dynamic and Local Dynamic) only. Both of these models
require at least one function call to access __thread variables
(the former requiring one per access, while the latter is one for
the first __thread variable accessed in a given function). This
will work just fine, no matter how you've implemented your
threading library.
One of the benefits of the Linux implementation is that it allows
the static TLS access methods (Initial Exec and Local Exec) to be
used. If your implementation fundamentally can't support these
access models, then just don't support them.
--
Gareth Hughes (gareth at nvidia.com)
OpenGL Developer, NVIDIA Corporation
More information about the freebsd-threads
mailing list