Life Cycle of Thread in OS

Reviews of
Thread: A process is divided into several light-weight processes, each light-weight process is said to be a thread. The thread has a program counter that keeps the tracks of which instruction to execute next, if process registers, which hold its current working variables. It has a stack which contains the executing thread history. The life cycle of thread is  Born state, Ready state, Running state, Blocked State, Sleep, Dead.

The number of threads can share an address space, open files and other resources. Same as the number of the process can share physical memory, disks, printers and the other resources. Because threads have some of the properties of the process. Threads operate in many respects, in the same manner as the process. Threads share the CPU and only one thread at a time is active.

Example of Thread:
Word Processor: A programmer wish to type the text in word processor. Then the programmer opens a file in a word processor and typing the text (It is a thread), the text is automatically formatting (It is another thread). The text automatically specifies the spelling mistakes (It is another thread), and the file is automatically saved in the disk (It is another thread).



Life Cycle of Thread

1. Born State: A thread that has just created.
2. Ready State: The thread is waiting for the processor (CPU).
3. Running: The System assigns the processor to the thread means that the thread is being executed.
4. Blocked State: The thread is waiting for an event to occur or waiting for an I/O device.
5. Sleep: A sleeping thread becomes ready after the designated sleep time expires.
6. Dead: The execution of the thread is finished.

thread states

Recommended Posts:

Operating System
    1. Services of OS
    2. Functions of OS
    3. Major Achievements of OS
    4. Types of Operating Systems
    5. Characteristics of Modern OS
    6. Process States in OS
    7. Difference Between Program and Process
    8. Process Control Block (PCB) in OS
    9. Life Cycle of Thread in OS
    10. Difference between Process and Thread
    11. CPU Scheduling in OS
    12. First Come First Serve (FCFS) Scheduling