KEMBAR78
2 Life Cycle of A Thread in Java | PDF
0% found this document useful (0 votes)
11 views2 pages

2 Life Cycle of A Thread in Java

The document explains the life cycle of a thread in Java, which consists of five states: New, Runnable, Running, Non-Runnable (Blocked), and Terminated. It highlights that a thread enters the New state upon creation, transitions to Runnable after the start() method is invoked, and becomes Running when selected by the thread scheduler. The Non-Runnable state indicates the thread is alive but not eligible to run, while the Terminated state occurs when the run() method exits.

Uploaded by

Anima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

2 Life Cycle of A Thread in Java

The document explains the life cycle of a thread in Java, which consists of five states: New, Runnable, Running, Non-Runnable (Blocked), and Terminated. It highlights that a thread enters the New state upon creation, transitions to Runnable after the start() method is invoked, and becomes Running when selected by the thread scheduler. The Non-Runnable state indicates the thread is alive but not eligible to run, while the Terminated state occurs when the run() method exits.

Uploaded by

Anima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

9/23/2015 Life cycle of a thread in Java ­ javatpoint

Content Menu ▼

Life cycle of a Thread (Thread


States)
A thread can be in one of the five states. According to sun, there is
only 4 states in thread life cycle in java new, runnable, non­
runnable and terminated. There is no running state.

But for better understanding the threads, we are explaining it in the


5 states.

The life cycle of the thread in java is controlled by JVM. The java
thread states are as follows:

1. New
2. Runnable
3. Running
4. Non­Runnable (Blocked)
5. Terminated

1) New

http://www.javatpoint.com/life­cycle­of­a­thread 1/2
9/23/2015 Life cycle of a thread in Java ­ javatpoint

The thread is in new state if you create an instance of Thread class


but before the invocation of start() method.

2) Runnable

The thread is in runnable state after invocation of start() method, but


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

3) Running

The thread is in running state if the thread scheduler has selected it.

4) Non­Runnable (Blocked)

This is the state when the thread is still alive, but is currently not
eligible to run.

5) Terminated

A thread is in terminated or dead state when its run() method exits.

<<prev next>>

http://www.javatpoint.com/life­cycle­of­a­thread 2/2

You might also like