Showing posts with label notifyAll(). Show all posts
Showing posts with label notifyAll(). Show all posts

Saturday, 14 January 2012

Threads in Java – 2

Thread states


Threads can be in one of the following states:

New. After the thread is instantiated, the thread is in the New state until the start()method is invoked. In this state, the thread is not considered alive.

Runnable. A thread comes into the runnable state when the start() method is invoked on it. It can also enter the runnable state from the running state or blocked state. The thread is considered alive when it is in this state.

Running. A thread moves from the runnable state into the running state when the thread scheduler chooses it to be the currently running thread.

Alive, but not runnable. A thread can be alive but not in a runnable state for a variety