From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4B58106A.2010306@domain.hid> Date: Thu, 21 Jan 2010 09:29:30 +0100 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <181804936ABC2349BE503168465576460D7138C6@domain.hid> In-Reply-To: <181804936ABC2349BE503168465576460D7138C6@domain.hid> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai-help] POSIX skin default stacksize List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Steve Deiters Cc: xenomai@xenomai.org Steve Deiters wrote: > I'm trying to determine the source of a bogus initial stack size after I > initialize a pthread_attr_t with pthread_attr_init. I'm using the POSIX > skin (obviously), but I'm not quite sure if it is getting this parameter > from Xenomai or libc. > > I'm running on a custom PowerPC board with a version 2.6.24.6 kernel. I > get the same result using both Xenomai 2.4.10, and 2.5.0. I noticed the > issue after having a small program with a few number of threads that was > crashing the system with an out of memory exception. > > I have a very basic program ... > > ----------------------main.c-------------------------- > #include > #include > #include > > int main(int argc, char **argv) > { > size_t s; > pthread_attr_t a; > > pthread_attr_init(&a); > pthread_attr_getstacksize(&a, &s); > > printf("PTHREAD_STACK_MIN is %d\n", PTHREAD_STACK_MIN); > printf("Default stack size is %d\n", s); > > return 0; > } > ----------------------------------------------------- > > For which the output is > >> PTHREAD_STACK_MIN is 16384 >> Default stack size is 8388608 > > As you can see, the stack size after I call pthread_attr_init is a > whopping 8 MB. > > From what I can tell, it is linking against the correct library. I can > see the Xenomai options to the linker, with the -lpthread_rt and all > that. > > Any idea why this would occur? We do not wrap calls to pthread_attr_init, pthread_attr_setstacksize. What you see are glibc default for your platform. If you want a different size, use pthread_attr_setstacksize. Glibc default are made for general purpose application running on multi-gigas memory x86 boxes. For other applications, you end up in endless calls to the heavy-weith pthread interface, pthread_attr_init, pthread_attr_setstacksize, pthread_attr_setinheritsched, pthread_attr_setschedpolicy, pthread_attr_setschedparam, pthread_mutexatttr_init, pthread_mutexattr_setprotocol, pthread_mutexattr_settype, etc... > > Thanks > > > _______________________________________________ > Xenomai-help mailing list > Xenomai-help@domain.hid > https://mail.gna.org/listinfo/xenomai-help -- Gilles.