lHow
does the Java runtime schedules CPU time among threads?
–If a thread is
blocked (I/O) or sleep, it uses no CPU time
–The runtime
chooses the thread with the highest priority
–If all threads
have the same priority (then order is not defined)
lPreempting
threads (share processor)
lAllow
one thread to run till it gives up the processor. All other threads will be
starved of CPU time
lBecause
of this, you should not perform long compute-bound tasks without
calling Thread.yield() periodically