* [Xenomai-core] [PATCH] reduce stack size in accuracy demo
@ 2006-03-17 12:09 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2006-03-17 12:09 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
[-- Attachment #1.1: Type: text/plain, Size: 535 bytes --]
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).
[-- Attachment #1.2: accuracy-thread.patch --]
[-- Type: text/plain, Size: 1104 bytes --]
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,¶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)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-03-17 12:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-17 12:09 [Xenomai-core] [PATCH] reduce stack size in accuracy demo Jan Kiszka
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.