POSIX threads won't execute concurrently?

Martin Galvan martin.galvan at tallertechnologies.com
Wed Aug 27 17:58:00 UTC 2014


Hi everyone! I'm trying to run a simple program to test how RTEMS
handles concurrency when using POSIX threads. My code is fairly
simple: it creates two pthreads with each one printing its name in a
loop. Normally I'd get something like:

Thread 1
Thread 1
Thread 2
Thread 2
Thread 1
Thread 1
Thread 2
...

and so on. However, when I try this on RTEMS the second thread will
begin execution only after the first one ends, thus resulting in
something like:

Thread 1
Thread 1
Thread 1
...
End of Thread 1.
Thread 2
Thread 2
Thread 2
...
End of Thread 2.

I'm using the following configuration:

#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */
#define CONFIGURE_TICKS_PER_TIMESLICE   20   /* 20 milliseconds */
#define CONFIGURE_MAXIMUM_POSIX_THREADS 4
#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT

#include <rtems/confdefs.h>

Am I doing something wrong here?


More information about the users mailing list