POSIX vs RTEMS Classic Scheduling Priorities

Joel Sherrill joel.sherrill at OARcorp.com
Mon Feb 15 22:35:39 UTC 2010

On 02/13/2010 12:54 AM, rtwas wrote:
> Hello,
> I'm developing an app that uses both Rtems-Classic Tasks and Posix Threads.
> The priority systems are somewhat different. Rtems has a priority numbering
> system running from 0-255 with the smaller number being higher in priority.
> Posix on the other hand uses larger numbers to represent higher priorities.
> The exact span of of Posix appears to be implementation specific (linux
> being 1-99).
> To properly schedule my threads I'll need to adjust the priorities of
> Rtems (networking etc) tasks and my main pthread such that the main
> pthread has
> the higher priority.  To do that I'll need to know how to relate the two
> priority numbering
> schemes (so I can pick the right priority numbers for each priority
> scheme). My
> assumption is that they can both be viewed as number-lines and that with
> the proper
> scaling and offsets the two priority number-lines can be correlated.
> Reading through
> the docs I have been unable to locate any information that would pin
> down how to
> relate the two priority systems.
They both are technically converted to SuperCore Thread
priorities but Classic API priorities are the same as in
the SuperCore.

The priorities are inverted in POSIX with 254 being the
most important thread (e.g. POSIX_SCHEDULER_MAXIMUM_PRIORITY)
not 1.

The methods are in cpukit/posix/inline/rtems/posix/priority.inl

RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
   int priority
   return (Priority_Control) (POSIX_SCHEDULER_MAXIMUM_PRIORITY - 
priority + 1);

RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
   Priority_Control priority
   return (POSIX_SCHEDULER_MAXIMUM_PRIORITY - priority + 1);

> Help appreciated.
> Robert W.
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users

More information about the users mailing list