Operating System - Interview Questions and Answers for 'Thread states' - 7 question(s) found - Order By Newest 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) TestUsually asked only to fresh graduates. Q2. 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 Q3. 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 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