/***************************************************************************** C-DAC Tech Workshop : hyPACK-2013 October 15-18, 2013 Example : pthread-stack.c Objective : To illustrate basic stack management. Input : None. Output : Default Stack Size Amount of stack needed per thread. Sequence of thread creation with stack size. Created : August-2013 E-mail : hpcfte@cdac.in ******************************************************************************/ #include #include #include #define NTHREADS 4 #define N 1000 #define MEGEXTRA 1000000 pthread_attr_t attr; void *dowork(void *threadid) { double A[N][N]; int i,j; size_t mystacksize; pthread_attr_getstacksize (&attr, &mystacksize); printf("Thread %d: stack size = %li bytes \n", threadid, mystacksize); for (i=0; i