# Thread Lifecycle

A thread can exist in multiple states: NEW, RUNNABLE, WAIT, TIMED\_WAITING, BLOCKED, or TERMINATED. A thread doesn’t begin its execution with its instantiation. Figure below shows the various phases of a thread, including the methods that can be called on a thread object in each state, which makes it transition from one state to another.

![](/files/-LTw4QTWCyewvOgL6qNj)

![](/files/-LTwxlCg-Yq7peXXHy2S)

#### Note:

Thread scheduling is specific to the underlying OS on every system. As a programmer, you can’t control or determine when a particular thread transitions from the READY state to the RUNNING state, and when it actually gets to execute. A thread scheduler fol- lows various scheduling mechanisms to utilize a processor efficiently, and also to give a fair share of processor time to each thread. It might suspend a running thread to give way to other READY threads and it might execute it later. The READY and the RUNNING states are together referred to as the RUNNABLE state.

![](/files/-LTx9xthS7vo50HGv1qb)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gyansetu-java.gitbook.io/core-java/threads/thread-lifecycle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
