1) New/Born: When we create object of thread class, it is
in new or born state.
2) Runnable/Ready:
After creating object, when we call start() method of thread class, it comes
into runnable or ready state.
3) Running:
When thread scheduler will assign or allocate processor while calling run()
method to thread then it comes into running state.
4) Dead:
After completion of job assigned to thread, when we call stop() method then it
comes to dead state.
5) Yield:
It means, we want back to Runnable/Ready state. For this, we need to call
static method of Thread class yield().
6) Blocked:
When we call join() method, that’s mean we want to block till the joined thread
will complete its job or till the time not get finished or not get interrupted.
7) Sleep:
When we call sleep() method, thread will exists into sleeping state.
8) Waiting: While calling wait() method, thread comes into waiting state. It will
come to ready state only if we call notify() or notifyAll() method.
9) Suspended: While calling suspend() method, thread comes into suspend state. It will
come to ready state only if we call resume() method
No comments:
Post a Comment
Thank you for your comments.