This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: thread_self() and STACK_GROWS_UP


On Mon, Jun 05, 2006 at 09:46:16AM +0100, Will Newton wrote:
> Well our Linux port statically allocates the top 8Mb of the process
> address space for the stack. I am aware that this is a serious
> limitation, but because we are targetting the embedded market it's not
> top of the list for fixing right now.
> 
> As I understand it the thread stacks should look like:
> 
> 0x3fc00000 -> thread 1 stack (for 2Mb)
> 0x3fa00000 -> thread 0 stack (for 2Mb)
> 0x3f800000 -> __pthread_initial_thread_bos and bottom of process stack (for 
> 2Mb)
> 
> Although we actually use smaller per-thread stacks for obvious reasons.
> 
> Does that seem correct?

Not especially, no.  Thread stacks don't need to be anywhere in
particular, and LinuxThreads normally allocates them with mmap.  So
why put them "above" your initial thread stack, instead of letting that
mmap put them in the heap, as it would do by default?

It's that layout difference which is messing you up, not the fact that
your stack grows up.

-- 
Daniel Jacobowitz
CodeSourcery


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