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

一张图让你彻底明白线程生命周期

时间:2014-08-26 17:21:46      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:线程   thread   java   

bubuko.com,布布扣

以下是对应的状态机说明:

0到4分别表示:CREATED, TERMINATED,RUNNABLE, RUNNING 和 NON_RUNNABLE

THREAD       = CREATED,
CREATED      = (start          ->RUNNABLE
               |stop           ->TERMINATED),
RUNNING      = ({suspend,sleep}->NON_RUNNABLE
               |yield          ->RUNNABLE
               |{stop, end}     ->TERMINATED
               | run            ->RUNNING),
RUNNABLE     = (suspend        ->NON_RUNNABLE
               | dispatch       ->RUNNING
               |stop           ->TERMINATED),
NON_RUNNABLE = (resume         ->RUNNABLE
               |stop           ->TERMINATED),
TERMINATED   = STOP.

说明:本内容摘自 <<Concurrency: State Models & Java Programs (2nd Edition)>>

一张图让你彻底明白线程生命周期

标签:线程   thread   java   

原文地址:http://blog.csdn.net/sourcefour/article/details/38850153

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