All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] reduce stack size in accuracy demo
Date: Fri, 17 Mar 2006 13:09:51 +0100	[thread overview]
Message-ID: <441AA70F.30805@domain.hid> (raw)


[-- 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,&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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

                 reply	other threads:[~2006-03-17 12:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=441AA70F.30805@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.