sparc-rtems, pthreads, help

Joel Sherrill joel.sherrill at OARcorp.com
Tue Mar 2 18:11:41 UTC 2004


sashti srinivasan wrote:
>  Hello,
>  
>       As you have suggested me, I have started using
>  sparc-rtems instead of posix bsp and simulate using
>  tsim simulator.  I want to measure the context
>  switching time using posix threads and mutexes.  I
>  create two posix threads( I tried with both default
>  attributes and SCHED_RR) for this purpose.  These
>  threads simply unlock a mutex and locks another
>  mutex(forcing context switch).  The parent thread
>  which created these threads waits for both of them by
>  calling pthread_join two times with these thread
>  ids.

Without seeing the program source, I can only guess but there
are two good things to guess.  First, unless you are root on
Linux you can't run anything but the default scheduler and
will get EPERM.  Second, RTEMS and Linux use different
default scheduling attributes.  There was a discussion
about this a while back and it looks like the UNIX
workstation pthreads generally choose one set of defaults
and the more real-time implementations tend to choose another.
So you have to explicitly set them on both systems to
get expected behavior.


>  Problem:
>      I see that One of the threads begin execution and
>  continues to execute till it it calls
>  pthread_mutex_lock.  The intention is, the other
>  thread will start execution and unlock that mutex the
>  first thread is waiting for.  But this does not
>  happen.  BUT SAME CODE WORKS ON LINUX AS INTENDED. 
>  Please guide me.

Are you getting an error back?  Does the thread actually
block on the lock?

>  Regards
>  Srinivasan
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster
> http://search.yahoo.com





More information about the users mailing list