This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Initializing initial bottom of stack variable in pthread.c


On Fri, Jul 28, 2006 at 03:08:32PM -0700, Jay anonymous wrote:
> I downloaded glibc-linuxthreads-2.3.6.tar.gz and took
> a look at the __pthread_initial_thread_bos variable in
> pthread_initialize for the case when the stack grows
> down (line 534).  My first question is why is is it
> initializing for at least STACK_SIZE bytes below the
> current stack address?  Is this to account for the
> stack for the initial thread & the stack for the
> manager thread?  My second question is why the 2 *
> STACK_SIZE in the computation?  Since the stack is
> growing down and the computation consists of the &
> ~(STACK_SIZE - 1), this actually initializes the
> variable to 3 * STACK_SIZE from the top.  Is this
> correct?

No, this allocates STACK_SIZE for the manager thread and then
_at least_ STACK_SIZE for the initial thread.  Could be up to
2 * STACK_SIZE - 1, but will be at least as big as requested.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]