Multi Threading Models in Process Management
Last Updated :
01 Mar, 2024
Multi threading- It is a process of multiple threads executes at same time.
There are two main threading models in process management: user-level threads and kernel-level threads.
User-level threads: In this model, the operating system does not directly support threads. Instead, threads are managed by a user-level thread library, which is part of the application. The library manages the threads and schedules them on available processors. The advantages of user-level threads include greater flexibility and portability, as the application has more control over thread management. However, the disadvantage is that user-level threads are not as efficient as kernel-level threads, as they rely on the application to manage thread scheduling.
Kernel-level threads: In this model, the operating system directly supports threads as part of the kernel. Each thread is a separate entity that can be scheduled and executed independently by the operating system. The advantages of kernel-level threads include better performance and scalability, as the operating system can schedule threads more efficiently. However, the disadvantage is that kernel-level threads are less flexible and portable than user-level threads, as they are managed by the operating system.
There are also hybrid models that combine elements of both user-level and kernel-level threads. For example, some operating systems use a hybrid model called the “two-level model”, where each process has one or more user-level threads, which are mapped to kernel-level threads by the operating system.
Overall, the choice of threading model depends on the requirements of the application and the capabilities of the underlying operating system.
Here are some advantages and disadvantages of each threading model:
User-level threads:
Advantages:
Greater flexibility and control: User-level threads provide more control over thread management, as the thread library is part of the application. This allows for more customization and control over thread scheduling.
Portability: User-level threads can be more easily ported to different operating systems, as the thread library is part of the application.
Disadvantages:
Lower performance: User-level threads rely on the application to manage thread scheduling, which can be less efficient than kernel-level thread scheduling. This can result in lower performance for multithreaded applications.
Limited parallelism: User-level threads are limited to a single processor, as the application has no control over thread scheduling on other processors.
Kernel-level threads:
Advantages:
Better performance: Kernel-level threads are managed by the operating system, which can schedule threads more efficiently. This can result in better performance for multithreaded applications.
Greater parallelism: Kernel-level threads can be scheduled on multiple processors, which allows for greater parallelism and better use of available resources.
Disadvantages:
Less flexibility and control: Kernel-level threads are managed by the operating system, which provides less flexibility and control over thread management compared to user-level threads.
Less portability: Kernel-level threads are more tightly coupled to the operating system, which can make them less portable to different operating systems.
Hybrid models:
Advantages:
Combines advantages of both models: Hybrid models combine the advantages of user-level and kernel-level threads, providing greater flexibility and control while also improving performance.
More scalable: Hybrid models can scale to larger numbers of threads and processors, which allows for better use of available resources.
Disadvantages:
More complex: Hybrid models are more complex than either user-level or kernel-level threading, which can make them more difficult to implement and maintain.
Requires more resources: Hybrid models require more resources than either user-level or kernel-level threading, as they require both a thread library and kernel-level support.
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.
Many to Many 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.Â
It is the best multi threading model.

Many to One ModelÂ
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.Â
The thread management is done on the user level so it is more efficient.
Â

One to One ModelÂ
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.Â
As each user thread is connected to different kernel , if any user thread makes a blocking system call, the other user threads won’t be blocked.
Thread Libraries:
A thread library provides the programmer with an API for creating and managing threads. There are two primary ways of implementing a thread library. The first approach is to provide a library entirely in user space with no kernel support. All code and data structures for the library exist in user space. This means that invoking a function in the library results in a local function call in user space and not a system call. The second approach is to implement a kernel-level library supported directly by the operating system. In this case, code and data structures for the library exist in kernel space. Invoking a function in the API for the library typically results in a system call to the kernel.
Three main thread libraries are in use today: POSIX Pthreads, Windows, and Java. Pthreads, the threads extension of the POSIX standard, may be provided as either a user-level or a kernel-level library. The Windows thread library is a kernel-level library available on Windows systems. The Java thread API allows threads to be created and managed directly in Java programs.
Advantages of Multithreading in OS:
- Minimize the time of context switching- Context Switching is used for storing the context or state of a process so that it can be reloaded when required.
- By using threads, it provides concurrency within a process- Concurrency is the execution of multiple instruction sequences at the same time.
- Creating and context switching is economical – Thread switching is very efficient because it involves switching out only identities and resources such as the program counter, registers, and stack pointers.
- Allows greater utilization of multiprocessor architecture
Disadvantages of Multithreading in OS:
- A multithreading system operates without interruptions.
- The code might become more intricate to comprehend.
- The costs associated with handling various threads could be excessive for straightforward tasks.
- Identifying and resolving problems may become more demanding due to the intricate nature of the code.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Â
Similar Reads
Resource Management in Operating System
Resource Management in Operating System is the process to manage all  the resources efficiently like CPU, memory, input/output devices, and other hardware resources among the various programs and processes running in the computer. Resource management is an important thing because resources of a comp
3 min read
Difference between Multiprocessing and Multithreading
Multiprocessing uses multiple CPUs to run many processes at a time while multithreading creates multiple threads within a single process to get faster and more efficient task execution. Both Multiprocessing and Multithreading are used to increase the computing power of a system in different ways. In
3 min read
Process-Based and Thread-Based Multitasking
Multitasking operating system is an operating system that gives you the perception of two or more tasks/jobs/processes running simultaneously. It does this by dividing system resources amongst these tasks/jobs/processes and switching between the tasks/jobs/processes while they are executing over and
2 min read
Introduction of Process Management
Process Management for a single tasking or batch processing system is easy as only one process is active at a time. With multiple processes (multiprogramming or multitasking) being active, the process management becomes complex as a CPU needs to be efficiently utilized by multiple processes. Multipl
8 min read
Difference between Multitasking and Multiprocessing
When it comes to analyzing the productivity of systems in the contemporary environment of computing, the concepts of multitasking and multiprocessing become prominent. Although both concepts are bound to how a computer processes work, their mode of function and their purpose are entirely dissimilar.
5 min read
Difference between Multiprocessing and Multiprogramming
Multiprocessing and Multiprogramming both strategies are designed to increase the efficiency of the system by managing multiple tasks but with different principles of their own. But they share the common goal which is improving resource utilization and system throughput. So, understanding which one
5 min read
Difference between Multi-tasking and Multi-threading
Multi-tasking is the ability of an operating system to run multiple processes or tasks concurrently, sharing the same processor and other resources. In multitasking, the operating system divides the CPU time between multiple tasks, allowing them to execute simultaneously. Each task is assigned a tim
6 min read
Three State Process Model in Operating System
Pre-requisites: States of a Process in Operating Systems, Two-State Process Model in Operating SystemIn this article, we'll be discussing a three-state process model in an operating system and also discussing the need for this process model, how the process executes, what will be the possible transi
4 min read
Multiple-Processor Scheduling in Operating System
In multiple-processor scheduling multiple CPUs are available and hence Load Sharing becomes possible. However multiple processor scheduling is more complex as compared to single processor scheduling. In multiple processor scheduling, there are cases when the processors are identical i.e. HOMOGENEOUS
8 min read
Introduction of Process Synchronization
Process Synchronization is used in a computer system to ensure that multiple processes or threads can run concurrently without interfering with each other. The main objective of process synchronization is to ensure that multiple processes access shared resources without interfering with each other a
10 min read