From owner-freebsd-threads@FreeBSD.ORG Tue Mar 30 00:36:02 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50EA616A4CF for ; Tue, 30 Mar 2004 00:36:02 -0800 (PST) Received: from herring.rabson.org (mailgate.nlsystems.com [80.177.232.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id 94D8643D2F for ; Tue, 30 Mar 2004 00:36:01 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from herring.rabson.org (herring.rabson.org [10.0.0.2]) by herring.rabson.org (8.12.11/8.12.11) with ESMTP id i2U8ZoMg015838; Tue, 30 Mar 2004 09:35:50 +0100 (BST) (envelope-from dfr@nlsystems.com) From: Doug Rabson To: Daniel Eischen Date: Tue, 30 Mar 2004 09:35:49 +0100 User-Agent: KMail/1.6.1 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200403300935.49999.dfr@nlsystems.com> X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on herring.rabson.org X-Virus-Scanned: ClamAV version 'clamd / ClamAV version 0.65', clamav-milter version '0.60p' cc: freebsd-threads@freebsd.org Subject: Re: Thread Local Storage X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2004 08:36:02 -0000 On Monday 29 March 2004 23:36, Daniel Eischen wrote: > On Mon, 29 Mar 2004, Doug Rabson wrote: > > On Monday 29 March 2004 22:56, Daniel Eischen wrote: > > > On Mon, 29 Mar 2004, Doug Rabson wrote: > > > > On Monday 29 March 2004 22:26, Daniel Eischen wrote: > > > > > On Mon, 29 Mar 2004, Doug Rabson wrote: > > > > > > Surely the GNU TLS ABI is preferable? It generates much > > > > > > smaller code and needs many fewer relocations. > > > > > > > > > > No, we don't want an LDT for every thread and don't want > > > > > to force a syscall for a thread switch. > > > > > > > > But the code it generates is at least twice the size for > > > > dynamic TLS. It seems that the GNU people have done a better > > > > job defining the TLS abi for i386. > > > > > > About the only thing that uses TLS that I know is nvidia's > > > openGL. If you design an API correctly, there's no need > > > for TLS. I would hope that it's usage would be limited. > > > > I'd quite like to see us use it for stuff like errno, _res and > > other uglification currently in libc. Not until the 6.x timeframe > > though. > > I'd like to see libc free of TLS ;-) The _res stuff can be > avoided by modifying the implementation to use thread-safe > APIs. The current _res stuff can _almost_ be eliminated > by passing using pthread_getspecific() once and passing > the _res around internal APIs. That's actually a pretty > simple change. Unfortunately pthread_setspecific() and pthread_getspecific() don't work for non-threaded programs whereas 'int __thread errno' works anywhere. It would even work for evil cases where libpthread is loaded after program startup with dlopen.