In this topic, you will learn about, Thread.
Introduction to Thread:
Recalling that a process is defined by the resources it uses and by the location at which it is executing. There are many instances in which it would be useful for resources to be shared and access concurrently. This situation is similar to the case where a for x system call is invoked with a new program counter executing within the same address space. This concept is so useful that several new O.S are providing a mechanism to support it through a thread facility. A thread sometimes called a lightweight process (LWT), is a basic unit of CPU utilization and consist of a program counter register set and a stack space.
A traditional or heavyweight process is equal to a task with one credit. The task does nothing if no threads are in it, and a thread must be exactly one task.
In a multiple process implementation, each process executes the same code but has its own memory and file resources. One multithreaded process uses fewer resources than multiple redundant processes, including memory, open files, and CPU scheduling.
In many respects, the threads operate in the same manner as processes. Threads can be in one of several states-ready blocks, running or terminated. Like processes, threads share the CPU, and only one thread at a time is active. A thread within a process executes sequentially, and each thread has its own stack and program counter.
Threads provide a mechanism that allows sequential processes to make blocking system called by also achieving parallelism.
Threads are gaining in popularity because they have characteristics of heavyweight processes but can execute more efficiently.
Comment below if you have queries related to the above topic, Thread.