Execution of multiple threads on single CPU or on multiple CPU in some order is known as scheduling. Java run time environment support very simple deterministic scheduling algorithm called fixed scheduling algorithm.
This algorithm schedule the thread on the basis of thread priority relatively to other enable thread. every thread in java has priority at any given time when multiple thread are ready to be executed then runtime system chooses for execution of those threads which are enable and has highest priority .
If 2 thread having same priority are waiting for CPU then scheduler arbitrary choose 1 of them to run. JRE schedule the threads on priority basis but after that OS Level schedule the threads. But here we have OS level scheduling. Finally thread will get schedule by the system scheduler. It can be used any algorithm like Round-Robin, FCFS etc.so we should take care while setting thread priority, but it may or may not executed.
we know that every thread in java has some priority, when a thread is created then its default priority is given by JVM .If its main thread then it will be 5 and for other thread is the same priority as of its parent thread, A thread inherits priority from the thread that created it.However explicitly we can set the priority.
These methods throws some exceptions.