码迷,mamicode.com
首页 > 编程语言 > 详细

java线程状态

时间:2017-02-22 15:27:54      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:java   线程   

从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对应操作系统线程的阻塞状态。

线程状态的转换

技术分享

java线程状态

标签:java   线程   

原文地址:http://8365613.blog.51cto.com/8355613/1900171

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!