On Friday 08 September 2006 16:54, Mauricio Lin wrote: > Hi all, > > I have some threads program and the /proc/pid/maps output show the same > stack (initial and final addresses) for all running threads of an > application. The [stack] identifier is showed only for the first thread of a process, and its telling that the marked mapped memory region can auto-grow. That means that the kernel will initially create a small stack, and if the stack overflows the kernel will increase the stack size, within certain limits (see man getrlimit). The other threads stack is allocated dynamically, upon thread creation, and there is no marking to identify them in /proc/pid/maps. > According to the definition of threads, each thread should > contain its own stack, but how Linux can identify it? > See child_stack in man 2 clone. > Does thread in Linux contain its own stack? > > Since Linux kernel does not provide an explicit support for threads, > the stack can be a shared resource among threads, right? > Linux does provide explicit support for threads for a long time. Since 2.6 it provides better POSIX compliance. For more details see man 7 pthreads. tavi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/