From owner-freebsd-threads@FreeBSD.ORG Mon Mar 29 13:56:34 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 3E2FA16A4CE for ; Mon, 29 Mar 2004 13:56:34 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA90043D3F for ; Mon, 29 Mar 2004 13:56:33 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i2TLuXtf024354; Mon, 29 Mar 2004 16:56:33 -0500 (EST) Date: Mon, 29 Mar 2004 16:56:33 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Doug Rabson In-Reply-To: <200403292250.31315.dfr@nlsystems.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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: Mon, 29 Mar 2004 21:56:34 -0000 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. > You don't need a syscall at thread switch if you do something like: > > _thread_switch(...) > { > if (tcb doesn't have LDT entry) { > if (!free LDT entries) > steal LDT entry from non-running thread; > allocate LDT entry and point it at TLS goop for tcb. > } > load_gs(tcb's LDT sel); That's a system call on amd64. > ... > } > > I just have this feeling that the GNU ABI is going to get far better > testing and support in the future since thats what linux uses. -- Dan Eischen