Life Cycle of Thread in OS
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:
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).