Search Interview Questions
| More than 3000 questions in repository.
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Interview Questions and Answers
|Frequently asked to fresh graduates.
|Ans. Runnable - waiting for its turn to be picked for execution by the thread schedular based on thread priorities.
Running - The processor is actively executing the thread code. It runs until it becomes blocked, or voluntarily gives up its turn.
Waiting: A thread is in a blocked state while it waits for some external processing such as file I/O to finish.
Sleeping - Java threads are forcibly put to sleep (suspended) with Thread.sleep. they can resume using Thread.resume method.
Blocked on I/O - Will move to runnable after I/O condition like reading bytes of data etc changes.
Blocked on synchronization - Will move to Runnable when a lock is acquired.
Dead - The thread is finished working.
|Help us improve. Please let us know the company, where you were asked this question :
|Like Discuss Correct / Improve  java   threads   multi threading   scheduling   thread states   basic interview question Asked in 1 Companies basic   frequent
Try 2 Question(s) Test
| Which keyword is used to provide explicit access of a code block to single thread ?
|Can constructors be synchronized in Java ?
|Explain multithreading in Java ?
|What is a Deadlock ?
|Why Struts 1 Classes are not Thread Safe whereas Struts 2 classes are thread safe ?
|Why do we need Thread class even in case we execute thread using runnable interface ?
|What is the difference between time slicing and preemptive scheduling ?
|Difference between Process and Thread ?
|What is race condition ?