Thread

 Thread: A thread, also called a lightweight process (LWP). A thread is a stream of execution throughout the process code having its program counter which keeps track of lists of instruction to execute next, system registers which bind its current working variables. Threads are also termed as lightweight process. A thread uses parallelism which provides a way to improve application performance.   

  • It is the basic unit utilization of Microprocess. 
  •  It has its own program counter, a register set, and stack space.
  •  It shares with the pear threads its code section, data section, and OS resources such as open files and signals, collectively called a task.



·         The idea of a thread is that a process has five fundamental parts: code (“text”), data, stack, file input/output and signal tables. “Heavy-weight processes” (HWPs) have a significant amount of overhead when switching: all the tables have to be flushed from the processor for each task switch. Also, the only way to achieve shared information between HWPs is through pipes and “shared memory”. If a HWP spawns a child HWP using fork(), the only part that is shared is the text.         Threads reduce overhead by sharing fundamental parts. By sharing these parts, switching happens much more frequently and efficiently. Also, sharing information is not so “difficult” anymore: everything can be shared.

 Benefits of Threads:

  •       Takes less time to create a new thread than a process.
  •         Less time to switch between two threads within the same process.
  •         Less time to terminate a thread than a process.
  •     Since threads within the same process share memory and files, they can communicate with each other without invoking the kernel.
  •       Suspending a process involves suspending all threads of the process since all threads share the same address space.
  •       Termination of a process terminates all threads within the process.

Comments

https://asp-net22-23.blogspot.com/

classification of operating System

What is an operating System

Functions of Operating System

Layered Systems

operating system components

Services Provided by Operating System

Batch Operating System