Posix priority vs. RTEMS priority

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 31 04:51:02 UTC 2017


Hello Heinz,

the POSIX initialization threads are created with the default priority 
value (_POSIX_Threads_Default_attributes) which is POSIX 2. You can map 
a POSIX priority to the RTEMS priority via:

static int get_current_prio( pthread_t thread )
{
   rtems_status_code sc;
   rtems_task_priority prio;
   int max;

   sc = rtems_task_set_priority( thread, RTEMS_CURRENT_PRIORITY, &prio );
   rtems_test_assert( sc == RTEMS_SUCCESSFUL );

   max = sched_get_priority_max( SCHED_FIFO );

   return max + 1 - (int) prio;
}

On 30/03/17 15:16, Heinz Junkes wrote:
> Dear list,
>
> I’m a bit confused about the priorities used with POSIX in  RTEMS 4.12.
>
> In the system config I am using the POSIX initialization:
>
> extern void *EPICS_WITH_POSIX_Init(void *argument);
>
> #define CONFIGURE_POSIX_INIT_THREAD_TABLE
> #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT EPICS_WITH_POSIX_Init
>
> Requesting the task priority in EPICS_WITH_POSIX_Init() I get Prio “2” 
> whitch looks like “RTEMS_HIGH_PRIO” ?
>
> void *
> EPICS_WITH_POSIX_Init (void *argument)
> {
>  int policy;
>     struct sched_param param;
>
>     if (pthread_getschedparam(pthread_self(), &policy, &param) != 0)
> delayedPanic("pthread_getschedparam failed”);
>
>     printf(" main priority = %d\n", param.sched_priority);
>
> leads to the output:
>
> ...
>  main priority = 2
>
> ***** RTEMS Version: rtems-4.11.99.0 (PowerPC/Generic (classic 
> FPU)/beatnik) *****
>>
> I expected Prio 254 or 253 because at Posix higher priorities -> 
> higher value.
>
>
> What do I think wrong here?
>
> Heinz
>
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list