Table of contents | |
What is Thread in Operating Systems? | |
Why Do We Need Thread? | |
Components of Threads | |
Types of Thread in Operating System | |
User Level thread Vs Kernel Level thread | |
Multi threading models |
A thread is a single sequence stream within a process. Threads are also called lightweight processes as they possess some of the properties of processes. Each thread belongs to exactly one process. In an operating system that supports multithreading, the process can consist of many threads. But threads can be effective only if the CPU is more than 1 otherwise two threads have to context switch for that single CPU.
In a process, a thread refers to a single sequential activity being executed. these activities are also known as thread of execution or thread control. Now, any operating system process can execute a thread. we can say, that a process can have multiple threads.
These are the basic components of the Operating System.
Threads are of two types. These are described below.
Many operating systems support kernel thread and user thread in a combined way. Example of such system is Solaris. Multi threading model are of three types.
Many to many model.
Many to one model.
one to one model.
In this model, we have multiple user threads multiplex to same or lesser number of kernel level threads. Number of kernel level threads are specific to the machine, advantage of this model is if a user thread is blocked we can schedule others user thread to other kernel thread. Thus, System doesn’t block if a particular thread is blocked.
In this model, we have multiple user threads mapped to one kernel thread. In this model when a user thread makes a blocking system call entire process blocks. As we have only one kernel thread and only one user thread can access kernel at a time, so multiple threads are not able access multiprocessor at the same time.
In this model, one to one relationship between kernel and user thread. In this model multiple thread can run on multiple processor. Problem with this model is that creating a user thread requires the corresponding kernel thread.
10 videos|99 docs|33 tests
|
1. What is a thread in operating systems? |
2. Why do we need threads in operating systems? |
3. What are the components of a thread? |
4. What are the types of threads in an operating system? |
5. What is the difference between user-level threads and kernel-level threads? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|