bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack base and thread-specific data


From: Igor Khavkine
Subject: Re: Stack base and thread-specific data
Date: Wed, 08 Aug 2001 17:04:37 -0400

Roland McGrath wrote:
> 
> The fixed-alignment stacks assumption is a bad one.  That is an
> implementation details of cthreads that you should not presume one way or
> another.  In a proper pthreads implementation, stacks can be sized and
> located arbitrarily, so the mechanism of storing data at the base of the
> stack is not viable.  Thread-specific data is usually implemented with a
> per-thread global register, or on the x86 the equivalent using a specially
> set up segment register.  You can see how this is done in linuxthreads,
> and you can see the mach_i386 interfaces for setting up an LDT in Mach.
> You're going to need to understand all this stuff fully to implement pthreads.

I was considering using a reserved register (since there is no performance
loss this way), but x86 doesn't have enough registers for that. Using
segments is a very good idea, I'm looking into it now. However, we
would be limiting ourselves to 16,383 (2^14 - 1) logical threads. Which
is a reasonably large number, but initially I thought that it
was too restrictive because it would be less then the maximum number
of threads that Mach supports. But on a second look, right now
Mach only supports 1024 threads so we are safe.

Igor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]