[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Implementing TLS: step 1
- Subject: Implementing TLS: step 1
- From: marcel at xcllnt.net (Marcel Moolenaar)
- Date: Thu Jun 19 15:54:46 2003
On Thu, Jun 19, 2003 at 03:36:11PM -0700, Julian Elischer wrote:
> What happens when there is no thread.. (e.g. the UTS (User Thread
> Scheduler) is running and has not selected a thread to run?
The thread pointer has to point to the TLS for accesses to thread
local data. The thread pointer can point to anything if there's
no access to TLS.
For consistency you can have a sentinel structure (16-bytes), that
contains the indirection to mimic the common case. Or you can opt
to have TP (the thread pointer) point to the KSE when there's no
thread. This however can create unwanted complexity.
> Basically in libKSE there is what the kernel calls a thread, which is
> interpretted in userspace as a virtual CPU, and this is used to
> run user level threads. The kernel sets the thread-pointer register
> upcorrectly according to which of these "kernel visible threads"
> is running. This is a legitimate use of the thread pointer register as
> far as I see. In 1:1 (libthr) the two things are the same and it stops
It isn't on ia64. The thread pointer register has a predefined
meaning. You cannot point it to anything else than the TLS in
a process that has TLS. (if there's no TLS, the TP register is
I'm not sure the runtime specification pointed to there has the
TLS info. I'll update the page ASAP if it's missing.
Marcel Moolenaar USPA: A-39004 marcel_(_at_)_xcllnt_(_dot_)_net
Visit your host, monkey.org