
- Operating System Tutorial
- OS - Home
- OS - Overview
- OS - Components
- OS - Types
- OS - Services
- OS - Properties
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling algorithms
- OS - Multi-threading
- OS - Memory Management
- OS - Virtual Memory
- OS - I/O Hardware
- OS - I/O Software
- OS - File System
- OS - Security
- OS - Linux
- OS - Exams Questions with Answers
- OS - Exams Questions with Answers
- Operating System Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
What is the concept of thread?
A thread is a lightweight of process and is a basic unit of CPU utilization which consists of a program counter, a stack, and a set of registers.
Given below is the structure of thread in a process −
A process has a single thread of control where one program can counter and one sequence of instructions is carried out at any given time. Dividing an application or a program into multiple sequential threads that run in quasi-parallel, the programming model becomes simpler.
Thread has the ability to share an address space and all of its data among themselves. This ability is essential for some specific applications.
Threads are lighter weight than processes, but they are faster to create and destroy than processes.
Let us see the single thread model which is as follows −
Now, let us see about classical thread model which is as follows −
A process contains a number of resources like address space, open files, accounting information, etc. In addition to these resources, a process is also having a thread of control. For example, program counter, register contents, stack.
The idea of threads is to allow multiple threads of control to execute within one process. This is often called multithreading and threads are also known as lightweight processes.
Since threads in the same process share state and stack, switching between them is less expensive than switching between separate processes.
Individual threads within the same process are not completely independent but they are cooperating and all are from the same process.
The shared resources make it easier between threads to use each other’s resources. A new thread in the same process is created by a library routine like thread_create. Similarly, thread_exit terminates a thread.
- Related Articles
- What is the concept of Divestiture?
- What is the concept of hedging?
- What is the concept of Monolithic kernel?
- What is the concept of Rolling Settlement?
- What is the Concept of Disguised Unemployment?
- What is the concept of datagram packet switching?
- What is the concept of system call mechanism?
- What is the concept of interest rate swaps?
- What is the Selling Concept of Marketing Management?
- What is the Societal Concept of Marketing Management?
- What is Thread cancellation?
- What is the concept of Data Types in JavaScript?
- What is the concept of currency swaps (FX swaps)?
- What is the Concept of B2B and B2C Marketing?
- What is Net Concept of Working Capital?
