Indeed, some priority levels can map to the same "native" priority level. Here's the list (based on the Hotspot code in OpenJDK 6):
Solaris
- 1 ? 0
- 2 ? 32
- 3 ? 64
- 4 ? 96
- 5 – 10 ? 127
Of note is that on Solaris, you can't raise the thread priority above normal, only lower it: the priority value for 5 is the same as any of the higher values.
Linux
- 1 – 10 ? 4 – -5 (
nice
values)
Of note is that on Linux, different thread priorities in Java do map to distinct priority values at native level.
Windows
- 1 – 2 ?
THREAD_PRIORITY_LOWEST
- 3 – 4 ?
THREAD_PRIORITY_BELOW_NORMAL
- 5 – 6 ?
THREAD_PRIORITY_NORMAL
- 7 – 8 ?
THREAD_PRIORITY_ABOVE_NORMAL
- 9 – 10 ?
THREAD_PRIORITY_HIGHEST
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…