Many systems provide support for both user and kernel threads, resulting in different multithreading models.
Following are three multithreading model:
Many-to-One Model
The many-to-one model maps many user-level threads to one kernel thread.
Thread management is done by the thread library in user space, so it is efficient; but the entire process will block if a thread makes a blocking system call.
Also, because only one thread can access the kernel at a time, multiple threads are unable to nm in parallel on multiprocessors.
Example: Green threads- a thread library available for Solaris
Advantages:
More concurrency because of multiple threads can run in parallel on multiple CPUs.
Less complication in the processing.
Disadvantages:
Thread creation involves light-weight process creation.
Kernel thread is an overhead.
Limiting the number of total threads.
One-to-One Model
The one-to-one model maps each user thread to a kernel thread.
It provides more concurrency than the many-to-one model by allowing another thread to run when a thread makes a blocking system call; it also allows multiple threads to run in parallel on multiprocessors.
The only drawback to this model is that creating a user thread requires creating the corresponding kernel thread.
Because the overhead of creating kernel threads can burden the performance of an application, most implementations of this model restrict the number of threads supported by the system.
Linux, along with the family of Windows operating systems, implement the one-to-one model.
Advantages:
Mainly used in language system, portable libraries.
One kernel thread controls multiple user thread.
Disadvantages:
Parallelism is not supported by this model.
One block can blocks all user threads.
Many-to-Many Model
The many-to-many model 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 or a particular machine (an application may be allocated more kernel threads on a multiprocessor than on a uniprocessor).
The one-to-one model allows for greater concurrency, but the developer has to be careful not to create too many threads within an application (and in some instances may be limited in the number of threads she can create).
The many-to-many model suffers from neither of these shortcomings: developers can create as many user threads as necessary, and the corresponding kernel threads can run in parallel on a multiprocessor.
Also, when a thread performs a blocking system call, the kernel can schedule another thread for execution.
Advantages:
Many threads can be created as per user’s requirement.
Multiple kernel or equal to user threads can be created.
Disadvantages:
True concurrency cannot be achieved.
Multiple threads of kernel is an overhead for operating system