Search code examples
javamultithreadingthread-priority

java : Is Thread priority changed by JVM(implicitly)


When we create new Thread(Runnable target) It will have some priority as per parent thread. My question is, can the priority be changed by the JVM in any circumstance? I am not using setPriority(int) method.


Solution

  • If you are asking whether the Thread scheduler has to schedule the threads according to their priority, the answer is no.

    It can choose to do so (preemptive scheduling) but it's up to the platform to decide which scheduling algorithm to use.

    Some readings: