I would think the currently running thread would have to be moved to the ready state first. Then when the next thread is chosen from the runnable thread the one with the highest priority will be moved from ready to running. But in any good OS this would happen pretty fast. By the way not all OS using time sharing as the scheduling system. rob moreland
If another thread of highier priority is started, java makes the lower priority(currently running) thread to wait. If more than one thread exists with the same priority, Java quickly switches between them in round-robin fashion BUT only if the operating system uses time-slicing. In preemptive scheduling the highest priority thread continues to run until it dies, waits, or is preempted by a thread of higher priorit.
Always! Wait. Never. Shut up. Look at this tiny ad.
a bit of art, as a gift, the permaculture playing cards