All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Leonard <sleonard@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] SMP load
Date: Fri, 22 Oct 2010 17:48:30 -0400	[thread overview]
Message-ID: <4CC206AE.5010704@domain.hid> (raw)


I sort of have a newbie problem regarding getting multiple threads 
running on multiple cores (quad core). It did work on my previous system 
(2.5-rc1) but I can't get it to work with 2.5.5.2 (or 2.5.5.1, 2.5.4). 
Here's my small example:

#include <pthread.h>
void* thread( void* ){
   unsigned long long i=0;
   while( 1 ) i++;
   return NULL;
}

int main(){

   pthread_t tid1, tid2, tid3, tid4;
   pthread_attr_t at1, at2, at3, at4;

   pthread_attr_init( &at1 );
   pthread_attr_init( &at2 );
   pthread_attr_init( &at3 );
   pthread_attr_init( &at4 );

   pthread_create( &tid1, &at1, thread, NULL );
   pthread_create( &tid2, &at2, thread, NULL );
   pthread_create( &tid3, &at3, thread, NULL );
   pthread_create( &tid4, &at4, thread, NULL );

   pthread_join( tid1, NULL );

   return 0;
}

If I compile with
g++ main.cpp -lpthread
and run I get 400% load (4 cores)

If I compile with
g++ main.cpp `/usr/xenomai/bin/xeno-config --skin posix --cflags` 
`/usr/xenomai/bin/xeno-config --skin posix --ldflags`
I only get 100% load (1 core)

Regards.

/sl


             reply	other threads:[~2010-10-22 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 21:48 Simon Leonard [this message]
2010-10-22 21:52 ` [Xenomai-help] SMP load Simon Leonard
2010-10-22 21:54 ` Gilles Chanteperdrix

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=4CC206AE.5010704@domain.hid \
    --to=sleonard@domain.hid \
    --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.