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).
Index: ksrc/skins/posix/demos/accuracy.c
===================================================================
--- ksrc/skins/posix/demos/accuracy.c   (revision 702)
+++ ksrc/skins/posix/demos/accuracy.c   (working copy)
@@ -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,&paramA);
+    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,&paramB);
+    pthread_attr_setstacksize(&thattrB,PTHREAD_STACK_MIN);
     err = pthread_create(&thidB,&thattrB,&threadB,NULL);
 
     if (err)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to