During the second that the clockThread is asleep, the thread does not run, even if the processor becomes available. After the second has elapsed, the thread becomes Runnable again and, if the processor becomes available, the thread begins running again.
---from SUN <Java Toturial>
---from SUN <Java Toturial>
Thread.sleep其实是调用系统SLEEP指令!有空可以找操作系统的书看看!
好象不对吧.
应该是线程调度程序把该线程放入blocking queue.
运行中的进程或线程都有4个状态:执行,阻塞,就绪。
当一个正在运行的进程或线程调用sleep()方法时,操作系统将这个进程或线程暂时挂起,放入blocking queue中,然后执行就绪队列中的进程或线程,当
被挂起的进程或线程重新唤醒时,操作系统将它放入就绪队列中等待执行,而将当前执行的进程或线程挂起,放进blocking queue中。
大概上就是这么一个过程。