Threads, including separate virtual machine and application threads, have 32 possible priorities, which are divided into four priority classes: idle, normal, high, and real time. Furthermore, the normal priority class is divided into foreground and background subclasses. The following table shows how priorities are divided into classes:
Class | Priorities |
---|---|
Idle | 1-6, 15 (15 if the base-relative real-time thread priority is specified) |
Normal | |
Background | 1 or 5-9, 15 (1 if the base-relative idle thread priority is specified) |
Foreground | 1 or 7-11 or 15 |
High | 1 or 11-15 |
Real time | 16-31 |
Priority 0 is reserved for system use as the system idle priority. Classifying priorities helps to define dynamically variable priority ranges and establishes application guidelines to prevent monopolizing the system with simple set-priority system calls.