从JDK里,认识下JAVA线程状态

2018-01-24 10:51:46来源:https://www.jianshu.com/p/2e262130b02a作者:lalala579人点击

分享




状态转换图

1、new:新建状态。

2、runnable:可运行状态。可运行状态的线程正在Java虚拟机中执行,但它可能正在等待来自操作系统(例如处理器)的其他资源。

3、running:运行状态。

4、blocked:阻塞状态。monitor lock。A thread in the blocked state is waitingfor a monitor lock to enter a synchronized block/method or reenter asynchronized block/method after calling Object.wait( ).

5、waiting:等待状态。A thread is in the waiting state due tocalling one of the following methods:Object.wait();Thread.join();LockSupport.park()

6、terminated:终止状态。the thread has completed execution。





微信扫一扫

第七城市微信公众平台