Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What are multithreading models?
Multithreading models define the relationship between user threads and kernel threads. User threads are managed by thread libraries in user space without direct kernel support, while kernel threads are created and managed directly by the operating system kernel.
The mapping between user and kernel threads determines how efficiently an application can utilize system resources and achieve true parallelism on multiprocessor systems.
Types of Multithreading Models
There are three primary multithreading models that define how user threads are mapped to kernel threads −
Many-to-One Model
This model maps multiple user threads to a single kernel thread. Thread management occurs entirely in user space through thread libraries, making thread operations fast and efficient.
Advantages: Fast thread creation and switching since no kernel involvement is required.
Disadvantages: If one thread makes a blocking system call, the entire process blocks. Only one thread can access kernel services at a time, preventing true parallelism on multiprocessor systems.
One-to-One Model
This model maps each user thread to a separate kernel thread. Every user thread creation results in a corresponding kernel thread creation.
Advantages: Provides greater concurrency since blocking system calls don't affect other threads. Multiple threads can run in parallel on multiprocessor systems.
Disadvantages: Higher overhead due to kernel thread creation and management. System resources are consumed more quickly.
Examples: Linux, Windows NT/XP/Vista/7/10, Solaris 9 and later versions.
Many-to-Many Model
This model multiplexes many user threads to a smaller or equal number of kernel threads. The number of kernel threads may be specific to a particular application or machine.
Advantages: Combines benefits of both previous models. Developers can create many user threads as needed, while kernel threads can run in parallel on multiprocessors. When one thread blocks, another can be scheduled for execution.
Disadvantages: More complex to implement and manage than other models.
Examples: Solaris (prior to version 9), Windows with ThreadFiber package.
Comparison
| Model | Concurrency | Parallelism | Blocking Behavior | Overhead |
|---|---|---|---|---|
| Many-to-One | Limited | No | Entire process blocks | Low |
