Thread States in Operating Systems

25 Nov, 2019
When a thread moves through the system, it is always in one of the five states:
(1) Ready
(2) Running
(3) Waiting
(4) Delayed
(5) Blocked 
Excluding CREATION and FINISHED state.
When an application is to be processed, then it creates a thread.It is then allocated the required resources(such as a network) and it comes in the READY queue.When the thread scheduler (like a process scheduler) assign the thread with processor, it comes in RUNNING queue.When the process needs some other event to be triggered, which is outsides it’s control (like another process to be completed), it transitions from RUNNING to WAITING queue.When the application has the capability to delay the processing of the thread, it when needed can delay the thread and put it to sleep for a specific amount of time. The thread then transitions from RUNNING to DELAYED queue.An example of delaying of thread is snoozing of an alarm. After it rings for the first time and is not switched off by the user, it rings again after a specific amount of time. During that time, the thread is put to sleep.When thread generates an I/O request and cannot move further till it’s done, it transitions from RUNNING to BLOCKED queue.After the process is completed, the thread transitions from RUNNING to FINISHED.
When an application is to be processed, then it creates a thread.
It is then allocated the required resources(such as a network) and it comes in the READY queue.
When the thread scheduler (like a process scheduler) assign the thread with processor, it comes in RUNNING queue.
When the process needs some other event to be triggered, which is outsides it’s control (like another process to be completed), it transitions from RUNNING to WAITING queue.
When the application has the capability to delay the processing of the thread, it when needed can delay the thread and put it to sleep for a specific amount of time. The thread then transitions from RUNNING to DELAYED queue.An example of delaying of thread is snoozing of an alarm. After it rings for the first time and is not switched off by the user, it rings again after a specific amount of time. During that time, the thread is put to sleep.
An example of delaying of thread is snoozing of an alarm. After it rings for the first time and is not switched off by the user, it rings again after a specific amount of time. During that time, the thread is put to sleep.
When thread generates an I/O request and cannot move further till it’s done, it transitions from RUNNING to BLOCKED queue.
After the process is completed, the thread transitions from RUNNING to FINISHED.
The difference between the WAITING and BLOCKED transition is that in WAITING the thread waits for the signal from another thread or waits for another process to be completed, meaning the burst time is specific. While, in BLOCKED state, there is no specified time (it depends on the user when to give an input).
In order to execute all the processes successfully, the processor needs to maintain the information about each thread through Thread Control Blocks (TCB).
mutli-threading
Processes & Threads
GATE CS
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between Clustered and Non-clustered index
Three address code in Compiler
Introduction of Process Synchronization
Differences between IPv4 and IPv6
Phases of a Compiler
Banker's Algorithm in Operating System
Disk Scheduling Algorithms
Introduction of Deadlock in Operating System
Paging in Operating System
File Allocation Methods