1.

States of a Thread in C#

Answer»

The thread life cycle in Java CONTAINS 5 states and the thread can be in any of these 5 states at a given time. These 5 states constitute the thread life cycle and this life cycle is started when an instance of the CLASS System.Threading.Thread is created.

The 5 states in a thread life cycle are:

1. Unstarted

When an instance of the thread class has been created, then the thread is in the unstarted state.

2. Runnable

When the start() METHOD is called but the thread SCHEDULER has not selected the thread for execution, at that time the thread is in the runnable state.

3. Running

If the thread scheduler has selected a thread and it is currently running, then it is in the running state.

4. Blocked (Non-runnable)

When a thread is not eligible to run but still ALIVE, then it is in the blocked state.

5. Terminated

The thread is in the terminated state after it has completed its execution.



Discussion

No Comment Found