Implement Threads in User Space
In this article, you will learn the implement threads in user space with their advantages and disadvantages.
An operating system is a collection of programs that share the hardware and software resources of the computer system with the user. It distinguishes between user-defined and operating-system code to ensure that an improper application doesn't cause harm to other programs or the operating system. The concept is that only the tasks running on the operating system receive hardware support, which is referred to as kernel mode. In contrast, the task executing on a user program is not known as user mode.
A thread is a type of execution unit which is a part of a process. It distributes the process's resources. The scheduler schedules it. There are two methods for implementing a thread: user space or kernel space.
Threads may be implemented in user space without the kernel's assistance. When we implement a thread in the user space, the following things happen:
User-level thread models
User-level thread in the user space may be implemented using any of the following four methods: -
User-level threads are mapped to kernel-level threads in all models. The kernel thread is equivalent to a process in a non-threaded system. The kernel thread is the execution unit that the kernel schedules to run on the CPU. Instead of kernel thread, the term virtual processor is frequently used.
In this one-to-one type of model:
In this many-to-one type of model:
In this many-to-many type of model:
In this type of model:
Advantages and disadvantages of implementing threads in User Space
Here, you will learn the advantages and disadvantages of threads in user space. Some of the advantages and disadvantages of threads in user space are as follows:
Next TopicDifference between ISR and Function Call