
- 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 are multithreading models?
Threads that are available at user level are called as user threads. Threads available at kernel level are called kernel threads. User threads are supported above the kernel and are managed without kernel support and kernel threads are supported and managed directly by the operating system.
Types of multithreading models
The different types of multithreading models are as follows −
Many-to-one model
It maps many user threads to one kernel thread. The thread management is based on the thread library in user space, because of this it is efficient but the entire process is going to block if a thread makes a blocking system call.
So, only one thread can access the kernel space at a time, multiple threads are unable to run in parallel on the multiprocessor.
The diagram of many-to-one model is as follows −
One-to-one model
It maps every user thread to a kernel thread. It provides more concurrency than a many-to-one model by allowing another thread to run when a thread makes a blocking system call. It allows multiple threads to run in parallel on a multiprocessor.
The drawback of this model is that creating a user thread requires creating the corresponding kernel thread, so the overhead of creating kernel threads can burden the performance of an application.
The examples include Linux, Windows.
The diagram of one-to-one model is as follows −
Many-to-Many model
It multiplexes many user level threads to a smaller or equal number of kernel threads. The number of kernel threads may be specific to either a particular application. And many-to-one models allow the developer to create as many user threads and true concurrency is not gained because the kernel can schedule only one thread at a time.
Whereas one-to-one model allows greater concurrency but the developers are not creating many threads with an application.
So, finally the many-to-many overcome all these problems. Here developers create as many user threads as necessary and the corresponding kernel threads can run in parallel on a multiprocessor. When a thread performs a blocking system call, the kernel can schedule another thread for execution.
The diagram of many-to-many model is as follows −
- Related Articles
- What are Generalized Linear Models?
- What are the basic computational models?
- What are the Three Common CRM Models?
- What are different models in machine learning?
- What is multithreading in C#?
- What are different database models? Explain their differences
- What are the different shared-memory multiprocessor models?
- What are the types of data mining models?
- What are the terminologies of Information Security Models?
- What are the approaches of Information Security Models?
- What Are the Compensation Models in Digital Marketing?
- What is a multithreading model in OS?
- Multithreading in Java
- Multithreading in C#
- Multithreading in C++
