Originally posted by sonu sharma: the high priority will make it have a preference over all other threads of lower prority.
Not necessarily.... I'd say it depends on the implementation of the JVM, and how it handles that. Some virtual machines can handle priorities one way and others will not care about it. That's why you should never rely on that when you program. As alton wrote, I'd say it is just a hint, a suggestion to the JVM, but nothing is guaranteed in here. my $0.02 [ July 01, 2003: Message edited by: Andres Gonzalez ]
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
The higher the integer, the higher the priority. At any given time, when multiple threads are ready to be executed, the runtime system chooses the runnable thread with the highest priority for execution. Only when that thread stops, yields, or becomes not runnable for some reason will a lower priority thread start executing. If two threads of the same priority are waiting for the CPU, the scheduler chooses one of them to run in a round-robin fashion. The chosen thread will run until one of the following conditions is true: * A higher priority thread becomes runnable. * It yields, or its run method exits. * On systems that support time-slicing, its time allotment has expired.
It seems that different books has its own take on the role of priority to thread scheduling.