It is the duty of the thread scheduler to provide the thread time to run, i.e., moving the thread the running state.Ī program implementing multithreading acquires a fixed slice of time to each individual thread. In the runnable state, the thread may be running or may be ready to run at any given instant of time. Runnable: A thread, that is ready to run is then moved to the runnable state.The active state contains two states within it: one is runnable, and the other is running. For a thread in the new state, the code has not been run yet and thus has not begun its execution.Īctive: When a thread invokes the start() method, it moves from the new state to the active state. New: Whenever a new thread is created, it is always in the new state. In Java, a thread always exists in any one of the following states. Next → ← prev Life cycle of a Thread (Thread States)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |