从java.lang.Thread.State可以看到java线程有以下状态:
NEW
A thread that has not yet started is in this state.RUNNABLE
A thread executing in the Java virtual machine is in this state.BLOCKED
A thread that is blocked waiting for a monitor lock is in this state.WAITING
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.TIMED_WAITING
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.TERMINATED
A thread that has exited is in this state.
These states are virtual machine states which do not reflect any operating system thread states.
操作系统定义的线程状态有:
新建,就绪,阻塞,运行,死亡。
java线程状态BLOCKED,WAITING,TIMED——WAITING对应操作系统线程的阻塞状态。
线程状态的转换
转载于:https://blog.51cto.com/8365613/1900171
本文介绍了Java线程的六种状态:NEW、RUNNABLE、BLOCKED、WAITING、TIMED_WAITING和TERMINATED,并解释了这些状态如何映射到操作系统的线程状态。此外,还探讨了线程状态之间的转换。

1532

被折叠的 条评论
为什么被折叠?



