* [Xenomai-help] POSIX skin default stacksize
@ 2010-01-20 23:57 Steve Deiters
2010-01-21 8:29 ` Gilles Chanteperdrix
0 siblings, 1 reply; 2+ messages in thread
From: Steve Deiters @ 2010-01-20 23:57 UTC (permalink / raw)
To: xenomai
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 <stdio.h>
#include <pthread.h>
#include <limits.h>
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?
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Xenomai-help] POSIX skin default stacksize
2010-01-20 23:57 [Xenomai-help] POSIX skin default stacksize Steve Deiters
@ 2010-01-21 8:29 ` Gilles Chanteperdrix
0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2010-01-21 8:29 UTC (permalink / raw)
To: Steve Deiters; +Cc: xenomai
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 <stdio.h>
> #include <pthread.h>
> #include <limits.h>
>
> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-21 8:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 23:57 [Xenomai-help] POSIX skin default stacksize Steve Deiters
2010-01-21 8:29 ` Gilles Chanteperdrix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.