In a Linux process, each thread has its own stack. In addition, what else is local for each thread. I read things like a file allocation table, etc. Can someone provide me with a list of things that relate to the thread and how they are located in memory.
Secondly, I noticed that when I allocate a stack for a stream (see the code below), the address of the first variable in the stream function is somehow pretty bytes after the address of the stack that I allocated ( stackAddr ). I think this is because the top of the stack is the end address of the allocated stack memory, since the difference in the value of the local variable address and the allocated stack is approximately equal to the size of the stack ( STACKSIZE ). In other words, it looks like it is growing from bottom to top.
pthread_attr_init( &attr[tid] ); stackAddr = malloc(STACKSIZE); pthread_attr_setstack( &attr, stackAddr, STACKSIZE );
Metallicpriest
source share