3i Infotech Placement: Sample Questions 463 - 463 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 463

Edit

Describe in Detail

Essay▾

What are the possible states a thread can have?

Explanation

A thread can be in one of the following states:

Define Thread State
  • Ready:
    • Waiting to execute.
    • Dispatcher considers only the pool of threads in ready state.
  • Standby:
    • Select to run next on a particular processor.
    • When correct condition exists, the dispatcher performs a context switch to the new thread.
    • Only one thread is in standby state for the processor on the system.
  • Running:
    • Dispatcher performs a context switch to a thread.
    • Thread enters the running state and executes.
    • Pre-empted a higher priority thread.
  • Waiting:
    • Thread waits for some IO, or synchronize event.
    • Thread can wait on environment subsystem or OS can direct the thread to suspend itself.
    • If the waiting event happens, depending on the priority, the waiting thread moves back to the ready state.
  • Transition:
    • A thread enters the transition state when it is ready for execution but kernel stack is paged out of memory.
    • When kernel stack is brought into memory, the thread enters the ready state.
  • Terminated:
    • When a thread finishes executing, it enters the terminated state.

Developed by: