donaricano-btn

Life cycle of a thread

- According to sun, there is only 4 states, new, runnable, non-runnable and terminated

- but this post I referred consist of 5 states to better understand the threads

1. New

- The thread is in new state 

- If you create an instance of Thread class 

2. Runnable

- The thread is in runnable state after invocation of start()

- the thread scheduler has not selected it to be the running thread

- sleep done, I/O complete, lock available, resume, notify

3. Running

- The thread is in running state

- The thread scheduler has selected it

4. Non-Runnable(Blocked)

- This is the state when the thread is sill alive

- it is currently not eligible to run

- sleep, block on I/O, wait for lock, suspend, wait

5. Terminated

- Dead state when its run() method exits


'Back-End > Java_1' 카테고리의 다른 글

[Java] Thread Scheduler  (0) 2016.10.07
[Java] Creating thread  (0) 2016.10.05
[Java] Multithreading in java  (0) 2016.10.05
[Java] Call by value  (0) 2016.09.13
[Java] Encapsulation  (0) 2016.09.12
블로그 이미지

리딩리드

,