tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Odd stacksize problem
adam.hoka%gmail.com@localhost said:
> increasing the stack size to 8M makes it overlap with something else
This can be explained:
On i386, the user address space ends at 0xbfc00000. This is
at a 4M alignment boundary, but in the middle of a naturally
aligned 8M block. Stack allocation in libpthread is rather
simplistic: it can only deal with naturally aligned ranges, all
of the same size which is power-of-two.
(The deeper reason is that the stack pointer value is the only
means to identify a thread.)
So the 8M block which matches the initial stack pointer is
only usable in the lower half, the upper half is already
kernel space.
(This also means that pthread_attr_setstacksize() etc are of
limited value.)
best regards
Matthias
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
Home |
Main Index |
Thread Index |
Old Index