Default POSIX thread attributes?

gregory.menke at gsfc.nasa.gov gregory.menke at gsfc.nasa.gov
Tue Feb 11 17:41:41 UTC 2003


Vladimir Nesic writes:
 > Current implementation of pthreads has a strange default attribute set, 
 > which is not documented, and it took me almost a whole month to find 
 > out why an app that worked on Linux stopped working on RTEMS.

These kinds of bugs can be <very> hard to track down on any operating
system.  If you rely on default pthread behavior, you're going to have
lots of problems.  The pthread interface kind of sucks in general- its
advantage is its sort of portable.

 
 > 2) Default scheduler is SCHED_FIFO, which means that threads are started 
 > at sorpriseingly high priority. 

This is likely not a priority problem as its possibly a scheduling
algorithm problem.  As I understand it, only root can create non-round
robin scheduled tasks in Linux.  Under RTEMS, you can choose priority
scheduling or round robin as you like.  Perhaps you're not being
exhaustive enough in your pthread attribute initialization.
 
 > 3) Scheduler and priority are inheritied by default, instead of set to 
 > default value, which ever default vaule is.
 
We always use #ifdefs to create native RTEMS tasks on rtems or pthread
tasks on Linux so we can take advantage of RTEMS when running on it.
We never rely on Linux to provide specific realtime scheduling at this
point.

Gregm





More information about the users mailing list