Java – Thread Scheduler
Thread scheduler is a part of Java Virtual Machine (JVM). It decides which thread should execute first among two or more threads that are waiting for execution.
It is decided based on the priorities that are assigned to threads. The thread having highest priority gets a chance first to execute.
If two or more threads have same priorities, we can’t predict the execution of waiting threads. It is completely decided by thread scheduler. It depends on the type of algorithm used by thread scheduler.