Sunday 23 August 2015

Thread States and Lifecycle in Java

Thread Lifecycle: Want to start the multithreaded programming? Before starting you need to know what is Thread and what is the life cycle of the Thread. Thread having different states and life cycle methods. To know about the thread you can Visit my last post Java Thread Example. Here we will talk about the life-cycle of the Thread.
Following are the states in the life cycle of the Threads :
  1. New: When we initialize the new thread using new operator, new thread is created and state is called New Thread. In this state thread is not active or running.
  2. Runnable: At the time when we call Thread.start() method, state of thread object changed to Runnable and it's now on OS that it when or how it will get CPU to run. In this state the control is given to Thread scheduler to finish its execution.
To View full blog about Thread States and Lifecycle in Java visit FindNerd.

No comments:

Post a Comment