[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sparc-rtems, pthreads, help
- Date: Tue, 02 Mar 2004 12:11:41 -0600
- From: joel.sherrill at OARcorp.com (Joel Sherrill)
- Subject: sparc-rtems, pthreads, help
sashti srinivasan wrote:
> 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
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.
> 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?
> Do you Yahoo!?
> Yahoo! Search - Find what you?re looking for faster