linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: schindele@nentec.de (Juergen Schindele)
To: linux-arm-kernel@lists.infradead.org
Subject: Problems with pthread on ARM/PXA270
Date: Wed, 16 Sep 2009 17:01:16 +0200	[thread overview]
Message-ID: <200909161701.16898.schindele@nentec.de> (raw)
In-Reply-To: <f17812d70909160714j1f691361k2a71d57d847e6e05@mail.gmail.com>

Am Mittwoch, 16. September 2009 schrieb Eric Miao:
> Don't remember we had such problems before. What kind of system
> and libraries are you using?
thanks for your reply.
System is custom PXA270 platform.
with codesourcery compiler (see below)
and glibc 2.5 with pthread.
I dont know what more information to give ?  
> 
> 
> On Wed, Sep 16, 2009 at 3:26 PM, Juergen Schindele <schindele@nentec.de> wrote:
> > Hello all,
> > we tried to implement a thread based software on our PXA270 based platform but
> > we had trouble with pthreads. So i modyfied a tiny progam to test. This little progam creates
> > 10 threads and each thread does print something (an index an a pointer to itself).
> >
> > On my PC with Suse 11.0 Linux (kernel 2.6.27) this works fine as supposed to.
> > Each thread has his turn and print his own values.
> >
> > But on our pxa270 platform the thread switch does not (or really rarely) happen
> > and only one thread is printing always the same values. So i suppose thread
> > switching is not working!
> >
> > Any hints or experiences are welcome !!!
> >
> > we use codesourcery compiler
> > arm-none-linux-gnueabi-gcc (CodeSourcery Sourcery G++ Lite 2007q1-10) 4.2.0 20070413 (prerelease)
> > Copyright (C) 2007 Free Software Foundation, Inc.
> > This is free software; see the source for copying conditions. ?There is NO
> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> >
> > and here the C-code compiled with ?"arm-none-linux-gnueabi-gcc -o test test.c -lpthread"
> >
> > #include <errno.h>
> > #include <error.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <pthread.h>
> > #include <time.h>
> >
> > #define NUM_THREADS 10
> > #define NUM_ITERS ? 50
> > #define TIMEOUT_NS ?100000000L
> >
> > static void *thread (void *);
> > static int argument[NUM_THREADS];
> > static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> > static pthread_attr_t defaultattr;
> >
> > static void * print_thread (void *arg)
> > {
> > ? ?int i;
> > ? ?int number = *((int*)arg);
> >
> > ? ?for (;;) {
> > ? ? ? ?pthread_t self = pthread_self ();
> > ? ? ? ?printf ("Thread %d is [%d]\n", number, self);
> > ? ?}
> > }
> >
> > int main (void)
> > {
> > ? ?pthread_t th;
> > ? ?int i, retvalue;
> >
> > ? ?struct sched_param param;
> > ? ?pthread_attr_init(&defaultattr);
> >
> > ? ?pthread_attr_setschedpolicy(&defaultattr, SCHED_RR);
> >
> > ? ?param.sched_priority = 10;
> > ? ?if ((retvalue = pthread_attr_setschedparam(&defaultattr, &param))!=0) {
> > ? ? ? ?printf ("ERROR\n");
> > ? ? ? ?exit (0);
> > ? ?}
> >
> > ? ?for (i = 0; i < NUM_THREADS; i++)
> > ? ?{
> > ? ? ? ?argument[i] = i;
> > ? ? ? ?if (pthread_create (&th, &defaultattr, print_thread, &argument[i]) != 0)
> > ? ? ? ? ? ?error (EXIT_FAILURE, 0, "cannot create thread");
> > ? ? ? ?printf ("Thread [%d]\n", i);
> > ? ?}
> >
> > ? ?while (1) {
> > ? ? ? ?;
> > ? ?}
> >
> > ? ?/* notreached */
> > ? ?return 0;
> > }
> >
> > --------------------------------------------------------------
> > J?rgen Schindele
> > Software-Entwicklung
> >
> > NENTEC Netzwerktechnologie GmbH
> > Greschbachstr. 12
> > 76229 Karlsruhe
> > Deutschland
> > Telefon: +49 721 94249-51
> > Telefax: +49 721 94249-10
> > E-Mail: ?schindele at nentec.de
> > WEB: ? ? www.nentec.de
> >
> > Gesch?ftsf?hrung: Klaus Becker, Roland Knapp
> > Sitz der Gesellschaft: Karlsruhe
> > Handelsregister: Amtsgericht Mannheim HRB 107658
> > --------------------------------------------------------------
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> >
> 
> 



-- 
--------------------------------------------------------------
J?rgen Schindele  
Software-Entwicklung

NENTEC Netzwerktechnologie GmbH
Greschbachstr. 12
76229 Karlsruhe
Deutschland
Telefon: +49 721 94249-51
Telefax: +49 721 94249-10
E-Mail:  schindele at nentec.de
WEB:     www.nentec.de
 
Gesch?ftsf?hrung: Klaus Becker, Roland Knapp
Sitz der Gesellschaft: Karlsruhe
Handelsregister: Amtsgericht Mannheim HRB 107658
 
Diese E-Mail enth?lt vertrauliche oder rechtlich gesch?tzte Informationen.
Wenn Sie nicht der vorgesehene Empf?nger sind, informieren Sie bitte sofort
den Absender und l?schen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail
oder die unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet.
 
The information contained in this message is confidential or protected by law.
If you are not the intended recipient, please contact the sender and delete this
message. Any unauthorised copying of this message or unauthorised distribution of
the information contained herein is prohibited.
--------------------------------------------------------------

  reply	other threads:[~2009-09-16 15:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16  7:26 Problems with pthread on ARM/PXA270 Juergen Schindele
2009-09-16 14:14 ` Eric Miao
2009-09-16 15:01   ` Juergen Schindele [this message]
2009-09-16 15:06     ` Eric Miao
2009-09-17  7:35       ` Juergen Schindele
2009-09-17 12:47         ` Beckwith, Stephen (Stephen)
2009-09-17 13:06           ` Juergen Schindele
2009-09-21 21:19           ` Beckwith, Stephen (Stephen)
2009-09-16 14:40 ` Daniel Jacobowitz
2009-09-18 10:06   ` Juergen Schindele
2009-09-18 14:10     ` Daniel Jacobowitz
2009-09-16 22:01 ` Jamie Lokier
2009-09-16 22:54 ` [arm-gnu] " James
2009-09-18  7:53   ` Uwe Kleine-König
2009-09-18 12:48     ` Jamie Lokier
2009-09-24  8:34 ` Juergen Schindele

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=200909161701.16898.schindele@nentec.de \
    --to=schindele@nentec.de \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).