java tutorial - Thread priority in java - java programming - learn java - java basics - java for beginners
Learn Java - Java tutorial - Thread priority in java - Java examples - Java programs
- Each thread has a priority.
- The priorities are represented by a number among 1 and 10.
- In the majority cases, thread scheduler schedules threads according to their priority (called as preemptive scheduling).
- But it is not guaranteed because it depends on JVM specification that which scheduling it chooses.
Constants of in Thread class
- public static int MIN_PRIORITY public static int NORM_PRIORITY public static int MAX_PRIORITY
- Default priority of a thread is 5 (NORM_PRIORITY). The value of MIN_PRIORITY is 1 and then the value of MAX_PRIORITY is 10.