Re: thread static

johnr@numega.com (John Robbins)
Mon, 28 Aug 1995 18:03:20 GMT

          From comp.compilers

Related articles
[6 earlier articles]
Re: thread static pardo@cs.washington.edu (1995-08-21)
Re: thread static mfinney@inmind.com (1995-08-22)
Re: thread static erik@kroete2.freinet.de (1995-08-22)
Re: thread static mercier@cinenet.net (1995-08-24)
Re: thread static meissner@cygnus.com (Michael Meissner) (1995-08-24)
Re: thread static stefan.monnier@epfl.ch (Stefan Monnier) (1995-08-28)
Re: thread static johnr@numega.com (1995-08-28)
| List of all articles for this month |
Newsgroups: comp.compilers
From: johnr@numega.com (John Robbins)
Keywords: parallel, C
Organization: Compilers Central
References: 95-08-078 95-08-159
Date: Mon, 28 Aug 1995 18:03:20 GMT

>[X86 machines don't have a whole lot of registers]


>We did a nifty trick for the threads library on Solaris/x86 that used
>one of the (often unused) extra segment registers. When the thread is
>created a new ldt entry is allocated and the segment value is stored
>in %gs. While it incurs a memory reference each thread can reference its
>thread pointer via %gs:0, very convenient and it saved using a register.


>This technique could easily extend to thread specific data, simply have
>the compiler generate code for TSD via offsets from %gs and have the
>runtime system allocate an appropriately sized block when the thread
>is created...


This is exactly what is done in both Windows NT and Win95. The Thread
Environment Block is stored in the FS register and 0x2C from the
beginning of that block is the pointer to the TLS (Thread Local
Storage) Array. This is very convenient for compiler writers and, in
our case, debugger writers!


John.




John Robbins johnr@numega.com
Nu-Mega Technologies, Inc
PO Box 7780
Nashua, NH 03060


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.