Re: Ada Task Priorities (Windows vs Linux)



"AAFellow@xxxxxxxxxxx" <AAFellow@xxxxxxxxxxx> writes:

Hi Everyone,

How are tasks prioritized in Ada when running on Linux (compared to
Windows). I wrote a small test program that I ran in Windows, and it
seems that the higher the number that I set the task's priority to, the
higher the priority that is given to that task (I thought the opposite
was true?)

In Ada, higher numbers mean higher priority.

In Linux (using GNAT complier), how are the priorities mapped? I know
a lower number means a higher priority, with a range of -20 to 19 and a
default of 0. Do we just use these same numbers in the Ada code when
setting the priorities of the tasks?

No. You use the numbers in the range System.Priority
(or sometimes, System.Interrupt_Priority).
The default is System.Default_Priority.

Look at the source code for package System to see what the numbers are.

The Ada run-time system will map these numbers to whatever the operating
system uses. If the operating system thinks lower numbers mean higher
priority, then the Ada run-time system will take that into account.

Also, (so we can verify we have set the priorities correctly) does
Linux provide a way to actually see what priority the OS has given to
tasks that the Ada code has started? Are there any tools availible
that can do this?

I think the 'top' program will show such info. Not sure.

- Bob
.