9 A Life Cycle of A Thread in Java

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

9/1/2021 Life cycle of a thread in Java - javatpoint

Home Java Programs OOPs String Exception Multithreading


⇧ SCROLL TO TOP

https://www.javatpoint.com/life-cycle-of-a-thread 1/7
9/1/2021 Life cycle of a thread in Java - javatpoint

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

⇧ SCROLL TO TOP

https://www.javatpoint.com/life-cycle-of-a-thread 2/7
9/1/2021 Life cycle of a thread in Java - javatpoint

Apache Spark Training


Live Instructor-Led Classes
Gain In-depth Knowledge on Spark

Streaming, Spark SQL, Spark RDD and More!

intellipaat.com

OPEN

1) New

The thread is in new state if you create an instance of Thread class but before the invocation of start()
method.

⇧ SCROLL TO TOP

https://www.javatpoint.com/life-cycle-of-a-thread 3/7
9/1/2021 Life cycle of a thread in Java - javatpoint

Ad

Apache Spark Training - Live Instructor-Led Classes

intellipaat.com/Apache... Visit Site

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 →

⇧ SCROLL TO TOP

https://www.javatpoint.com/life-cycle-of-a-thread 4/7
9/1/2021 Life cycle of a thread in Java - javatpoint


For Videos Join Our Youtube Channel: Join Now

Feedback

Send your Feedback to [email protected]

Help Others, Please Share

Learn Latest Tutorials

Digital Marketing Elasticsearch Entity Framework Firewall

Functional Google Colab Graph Theory Groovy


Programming

Group Discussion Informatica Ionic ITIL

IOS with Swift Angular Material Deep Learning

Preparation

⇧ SCROLL TO TOP
Aptitude Reasoning Verbal Ability Interview Questions
https://www.javatpoint.com/life-cycle-of-a-thread 5/7
9/1/2021 Life cycle of a thread in Java - javatpoint

Company Questions

Trending Technologies

Artificial AWS Selenium Cloud Computing


Intelligence

Hadoop tutorial ReactJS Data Science Angular 7


Tutorial Tutorial Tutorial
Hadoop
ReactJS Data Science Angular 7

Blockchain Git Tutorial Machine DevOps


Tutorial Learning Tutorial Tutorial
Git
Blockchain Machine Learning DevOps

B.Tech / MCA

DBMS tutorial Data Structures DAA tutorial Operating


tutorial System tutorial
DBMS DAA
Data Structures Operating System

Computer Compiler Computer Discrete


Network tutorial Design tutorial Organization and Mathematics
Architecture Tutorial
Computer Network Compiler Design
Computer Discrete
Organization Mathematics

Ethical Hacking Computer


⇧ SCROLLTutorial
TO TOP Graphics Tutorial

https://www.javatpoint.com/life-cycle-of-a-thread 6/7
9/1/2021 Life cycle of a thread in Java - javatpoint

Ethical Hacking Computer Graphics


Software html tutorial
Engineering
Web Technology
Tutorial
Software
Engineering

Cyber Security Automata C Language C++ tutorial


tutorial Tutorial tutorial
C++
Cyber Security Automata C Programming

Java tutorial .Net Python tutorial List of


Framework Programs
Java Python
tutorial
Programs
.Net

Control Data Mining Data


Systems tutorial Tutorial Warehouse
Tutorial
Control System Data Mining
Data Warehouse

⇧ SCROLL TO TOP

https://www.javatpoint.com/life-cycle-of-a-thread 7/7

You might also like