The Thread class has two static int fields called MIN_PRIORITY and MAX_PRIORITY , the actual values โโof which are potentially (if not realistic) for platforms 1 and 10 . It is theoretically possible that these values โโmay change in some future releases of Java. However, this is unlikely, not least because such a change would violate binary compatibility. (The value of a primitive constant can be bound to the code that uses it at compile time.) In any case, the specification (for example) of the setPriority method implies that the MIN_PRIORITY value will be less than or equal to the value of MAX_PRIORITY.
EDIT
And ... so you really want to know how Java priority values โโ(e.g. Thread.MIN_PRIORITY and Thread.MAX_PRIORITY ) are mapped to the priorities of the native Linux thread:
Again, priority mappings may be platform / JVM / version specific. The sun does not indicate what they are.
It is unlikely that you can define priority mappings in a pure Java application.
Experimentally, you can map mappings by setting different priorities for Java threads and looking at the corresponding priorities for your own Linux threads. (There is probably a way to get the ps command to print thread priorities.)
Alternatively, you can download and read the OpenJDK source code (for your version / platform) to see what the Java runtime actually performs.
EDIT 2
In fact, according to this page , comparing Java priorities with priorities of their own threads depends on (and can be explicitly set using) java parameters for HotSpot -XX. (Find the priority page.)
source share