reduce stack size in accuracy demo
PATCH 1/1 reduce stack size in accuracy demo
Hi Gilles,
running your accuracy demo on a resource restricted system aside a hungry cache benchmark (as load) produced OOM too early. This patch reduces the stack thread sizes (which get locked into memory) - and it also demonstrates how to create RT-pthreads preferably.
Jan
PS: cyclictest now runs as expected with pthread_setschedparam, will post some patch to the list and Thomas. I think it's useful as it can create multiple timed threads, and it's POSIX (latency is native, accuracy tests relative sleeping).
skins/posix/demos/accuracy.c +3 -0
@@ -12,6 +12,7 @@#include <unistd.h> #include <pthread.h> #include <semaphore.h> +#include <limits.h> #define SEMB_NAME "/semB"
@@ -229,6 +230,7 @@ int main (int argc, char **argv)pthread_attr_setinheritsched (&thattrA,PTHREAD_EXPLICIT_SCHED );pthread_attr_setschedpolicy (&thattrA,SCHED_FIFO );pthread_attr_setschedparam (&thattrA,¶mA); +pthread_attr_setstacksize (&thattrA,PTHREAD_STACK_MIN ); err =pthread_create (&thidA,&thattrA,&threadA,NULL );if (err)
@@ -239,6 +241,7 @@ int main (int argc, char **argv)pthread_attr_setinheritsched (&thattrB,PTHREAD_EXPLICIT_SCHED );pthread_attr_setschedpolicy (&thattrB,SCHED_FIFO );pthread_attr_setschedparam (&thattrB,¶mB); +pthread_attr_setstacksize (&thattrB,PTHREAD_STACK_MIN ); err =pthread_create (&thidB,&thattrB,&threadB,NULL );if (err)