Operating System - Interview Questions and Answers for 'Thread state' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

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.
Label / Company      Label / Company / Text

   



Operating System - Interview Questions and Answers for 'Thread state' - 7 question(s) found - Order By Rating

Usually asked only to fresh graduates.
 Q1. What is the initial state of a thread when it is created and started?
Ans. Ready state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     operating system   threads   multi threading   java   thread states     Asked in 1 Companies      basic        frequent


 Q2. What state does a thread enter when it terminates its processing?
Ans. When a thread terminates its processing, it enters the dead state.

 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


Frequently asked to fresh graduates.
 Q3. Explain Thread States ?Operating System
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


 Q4. Difference between yield() and sleeping()?
Ans. When a task invokes yield(), it changes from running state to runnable state. When a task invokes sleep(), it changes from running state to waiting/sleeping state.

 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   yield   sleeping


 Q5. What is the initial state of a thread when it is created and started ?

a. Wait
b. Running
c. Ready
d. Sleep
Ans. Ready

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   threads   multithreading   thread states


 Q6. What state does a thread enter when it terminates its processing?

a. Wait
b. Ready
c. Dead
d. Running
Ans. Dead

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   threads   multithreading   thread states


 Q7. Difference between Yielding and Sleeping ?
Ans. When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     multithreading  threads  yielding  sleeping  thread states



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: