This is theory part of life cycle of thread ( Multithreading)
Thread have 4 States
Thread have 4 States
- New Thread/State
- Runnable State
- Non-Runnable State
- Dead/Terminate State
Explain one by one what happen in this states :
New thread State :
- A thread is in this state when the instantiation of a thread object creates a new thread but does not start it running
- A thread starts life in the ready-to-run state
- You can call only the start() or stop() when the thread is in this state.
- Calling any methods besides start() or stop() causes an illegalThreadStateException.(run time exception)
- When the start() method is invoked on a new thread() it get to the runnable state or running state by calling the run() methods
- A runnable thread may actually be running or may be awaiting it turn to run
- A thread becomes not runnable when one of the following four events occurs
- When sleep method invoked and it sleeps for a specified amount of time
- When suspend() method is invoked
- When the wait() method is invoked
- The thread is blocking on I/O and waits for its completion
- if a thread has been put to sleep,then the specified number of millisecond must elapse(or it must be interrupted)
- if thread has been suspended() then its resume() method must be invoked.
- if a thread is waiting on a condition variable,whatever object owns the variable must relinquish it by calling either notify() or notifyAll().
- if a thread is blocked on I/O,then the I/O must complete.
- A thread enters this state when the run() method has finished executing or when the stop() method is invoked.
- Once in this state,the thread cannot ever run again.
Click to Next :
Sorting and Searching Programs
Start with your Choice
-Important
Programs for Freshers
- Palindrome Number
- Prime
Number
- Swapping
Number
- Leap Year
- Odd and
Even Number
- Fibonacci
Series
- Armstrong
Number
- Factorial
Number
- Print
Table
Learn Pattern Programs
- Alphabet
pattern program in java
- Star
Pattern Programs in Java
- Square
pattern programs in java
- Diamond
Star pattern programs in java
- Number
Pattern Programs in java
- Diagonal
pattern program in java
Click to learn Array Programs
- 4 ways to
print Array in Java
- 2-D Array
in Java
- Anonymous
Array in Java
- Single
Dimensional Array in Java
- Find
Second Largest Number in Array
- Delete an
Element in Array in Java
- Common
Element in Array in Java
- Missing
Element in Array
- Insert
Element in Array
- Reverse
Array in Java
- Merge
Two Array in Java
- Smallest
and Largest Elements in Array
- Find Odd
and Even Number in Array
Click to Learn MySQL
for any complaint regarding my Blog please visit contact us page and write what problem you
have!
Learn with us | HTML | CSS | JS | Bootstrap | JAVA | ADV JAVA | MySQL| GIT
Sorting and Searching Programs
Start with your Choice
-Important
Programs for Freshers
- Palindrome Number
- Prime
Number
- Swapping
Number
- Leap Year
- Odd and
Even Number
- Fibonacci
Series
- Armstrong
Number
- Factorial
Number
- Print
Table
Learn Pattern Programs
- Alphabet
pattern program in java
- Star
Pattern Programs in Java
- Square
pattern programs in java
- Diamond
Star pattern programs in java
- Number
Pattern Programs in java
- Diagonal
pattern program in java
Click to learn Array Programs
- 4 ways to
print Array in Java
- 2-D Array
in Java
- Anonymous
Array in Java
- Single
Dimensional Array in Java
- Find
Second Largest Number in Array
- Delete an
Element in Array in Java
- Common
Element in Array in Java
- Missing
Element in Array
- Insert
Element in Array
- Reverse
Array in Java
- Merge
Two Array in Java
- Smallest
and Largest Elements in Array
- Find Odd
and Even Number in Array
Click to Learn MySQL
for any complaint regarding my Blog please visit contact us page and write what problem you
have!
Learn with us | HTML | CSS | JS | Bootstrap | JAVA | ADV JAVA | MySQL| GIT
No comments:
Post a Comment