Nvidia, TLS and __thread keyword -- an observation
Terry Lambert
tlambert2 at mindspring.com
Wed Jun 18 23:40:28 PDT 2003
Marcel Moolenaar wrote:
> On Wed, Jun 18, 2003 at 02:05:04AM -0700, Terry Lambert wrote:
> > Marcel Moolenaar wrote:
> > > On Wed, Jun 18, 2003 at 07:48:09AM +0800, David Xu wrote:
> > > > I believe this will add overhead to thread creating and destroying,
> > > > How fast an RTLD can be in this case ?
> > >
> > > In the dynamic TLS model you would like to delay the creation of
> > > the TLS space. Normally __tls_get_addr() gets used for this. In
> > > the static TLS model you allocate the TLS when you llocate the
> > > thread control structure.
> >
> > Lazy binding in this context doesn't make a lot of sense.
>
> It does. In a process with 1000 threads where 1 thread does
> a dlopen(), you don't want to create 999 TLS spaces if they're
> not going to be used. Besides time, this also is a space
> issue.
If you wanted to save space, you would not be using per thread
storage in the first place. 8-). Time is only an issue if you
are talking .tdata; the .tbss is all zeroed, so could be allocated
as a very large block, with relatively no initialization overhead.
> Note also that I don't advocate what I think we should do, but
> what the specification is designed for. People have put some
> thought in it...
I understand the specification's intent, both the purely technical,
and the political.
-- Terry
More information about the freebsd-threads
mailing list