life cycle of thread life cycle of thread in java life cycle of thread in java with diagram life cycle of thread in java with example life cycle of a thread in java life cycle of a thread life cycle of thread in java ppt states of threads in java states of threads in java with example
States of Threads or Life Cycle
of Threads:
Whenever we write a multi
threading application there is a possibility of existing multiple threads. When
the java program is under execution, all those threads will undergoes various
stages. These stages are known as States of Thread.
States of thread are classified into five types. They are
1)
New State.
2)
Ready State.
3)
Running State.
4)
Waiting State.
5)
Halted State.
1) New State:
A new state is one in
which thread is created and it is about to enter into main memory
2) Ready State:
A Ready State is one in
which thread is entered into main memory, memory space is created for the
thread and first waiting for the C.P.U.
3) Running State:
A Running state is one in
which the thread is under the control of C.P.U.
4) Waiting State:
A Thread is said to be in
waiting state if and only if thread satisfies any of the following factors.
a) For the remaining C.P.U burst time: The
amount of time required by the thread from the C.P.U for it’s complete
execution is known as C.P.U burst time and it will be decided by O.S.
b)
Suspending the currently executing thread.
c)
Making the currently executing thread to sleep
for a specified period of time in terms of milliseconds.
d)
Making currently executing thread to wait for
period of time.
e)
Making the currently executing thread to wait
without specifying any period of time.
5) Halted State:
A Thread is said to be in halted state the thread
completed it’s execution.
Hence
as long as the thread is in new and halted states, whose execution status is
false, and these states are known as out memory states. Whereas as long as the
threads are in ready, running and waiting states. Whose execution status is true and
these states are known as in-memory states.
The Following Concepts Regarding Threads
The Following Concepts Regarding Threads
- Ways of Creating Threads
- Java.Lang.Thread
- Java.Lang.Runnable
- Internal Flow Of Thread
- Synchronization
- Inter Thread Communication
- Multi Threading PPT
No comments:
Post a Comment