Posix priority vs. RTEMS priority (Sebastian Huber)

Heinz Junkes junkes at fhi-berlin.mpg.de
Fri Mar 31 18:22:47 UTC 2017


Hello Sebastian,

thank you for your answer. In the RTEMS Manual you can read
that the initialization task should run at Maximum Priority (Classic API).
(which sounds reasonable)

If then the POSIX_Init should also be startet at that level -> POSIX prio 254?

Instead of the low prio “2” ?

Heinz

23.8.5 Specifying Classic API Initialization Task Priority

CONSTANT:
CONFIGURE_INIT_TASK_PRIORITY

DATA TYPE:
RTEMS Task Priority (rtems_task_priority).

RANGE:
One (1) to CONFIGURE_MAXIMUM_PRIORITY.

DEFAULT VALUE:
The default value is 1, which is the highest priority in the Classic API.

DESCRIPTION:

CONFIGURE_INIT_TASK_PRIORITY is the initial priority of the single initialization task defined by the Classic API Initialization Tasks Table.

NOTES:

None.


------------------------------------------------------------------------------
Fritz-Haber-Institut    | Phone:         (+49 30) 8413-4270
Heinz Junkes             | Fax (G3+G4):   (+49 30) 8413-5900
Faradayweg 4-6        | 
D - 14195 Berlin        | E-Mail:     junkes at fhi-berlin.mpg.de
------------------------------------------------------------------------------

On 31 March 2017 at 14:00:13, users-request at rtems.org (users-request at rtems.org) wrote:

Send users mailing list submissions to  
users at rtems.org  

To subscribe or unsubscribe via the World Wide Web, visit  
http://lists.rtems.org/mailman/listinfo/users  
or, via email, send a message with subject or body 'help' to  
users-request at rtems.org  

You can reach the person managing the list at  
users-owner at rtems.org  

When replying, please edit your Subject line so it is more specific  
than "Re: Contents of users digest..."  


Today's Topics:  

1. Posix priority vs. RTEMS priority (Heinz Junkes)  
2. Re: Posix priority vs. RTEMS priority (Sebastian Huber)  


----------------------------------------------------------------------  

Message: 1  
Date: Thu, 30 Mar 2017 15:16:48 +0200  
From: Heinz Junkes <junkes at fhi-berlin.mpg.de>  
To: "=?utf-8?Q?rtems-users=40rtems.org?=" <users at rtems.org>  
Subject: Posix priority vs. RTEMS priority  
Message-ID: <etPan.58dd0540.1c44c80b.89fd at fhi-berlin.mpg.de>  
Content-Type: text/plain; charset="utf-8"  

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  

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: <http://lists.rtems.org/pipermail/users/attachments/20170330/377614c0/attachment-0001.html>  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: smime.p7s  
Type: application/pkcs7-signature  
Size: 2209 bytes  
Desc: not available  
URL: <http://lists.rtems.org/pipermail/users/attachments/20170330/377614c0/attachment-0001.bin>  

------------------------------  

Message: 2  
Date: Fri, 31 Mar 2017 06:51:02 +0200  
From: Sebastian Huber <sebastian.huber at embedded-brains.de>  
To: Heinz Junkes <junkes at fhi-berlin.mpg.de>, "rtems-users at rtems.org"  
<users at rtems.org>  
Subject: Re: Posix priority vs. RTEMS priority  
Message-ID: <58DDE036.3030809 at embedded-brains.de>  
Content-Type: text/plain; charset=windows-1252; format=flowed  

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.  



------------------------------  

Subject: Digest Footer  

_______________________________________________  
users mailing list  
users at rtems.org  
http://lists.rtems.org/mailman/listinfo/users  

------------------------------  

End of users Digest, Vol 126, Issue 36  
**************************************  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170331/ca39d6e1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2209 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20170331/ca39d6e1/attachment.bin>


More information about the users mailing list