Multithreading allows the execution of multiple parts of a program at the same time. These parts are known as threads and are lightweight processes available within the process. Therefore, multithreading leads to maximum utilization of the CPU by multitasking.
The main models for multithreading are one to one model, many to one model, and many to many models. Details about these are given as follows −
One to One Model
The one-to-one model maps each of the user threads to a kernel thread. This means that many threads can run in parallel on multiprocessors and other threads can run when one thread makes a blocking system call.
A disadvantage of the one-to-one model is that the creation of a user thread requires a corresponding kernel thread. Since a lot of kernel threads burden the system, there is a restriction on the number of threads in the system.
A diagram that demonstrates the one to one model is given as follows −
ALSO READ
Operating System Study materials
Operating System Technigoo Publication Book
Many to One Model
The many to one model maps many of the user threads to a single kernel thread. This model is quite efficient as the userspace manages the thread management.
A disadvantage of the many-to-one model is that a thread blocking system call blocks the entire process. Also, multiple threads cannot run in parallel as only one thread can access the kernel at a time.
A diagram that demonstrates the many to one model is given as follows −
Many to Many Model
The many to many models maps many of the user threads to an equal number or lesser kernel threads. The number of kernel threads depends on the application or machine.
The many to many does not have the disadvantages of the one-to-one model or the many to one model. There can be as many user threads as required and their corresponding kernel threads can run in parallel on a multiprocessor.
A diagram that demonstrates the many to many models is given as follows −
Related Questions & Answers
- What are the Process States in Operating System?
- Write about Process Control Block.
- Write Various Operating System Services.
- What is the requirement to solve the Critical Section Problem?
- Write about the Priority Inversion Problem.
- Write various multithreading models.
- Discuss preemptive scheduling.
- Consider the following set of processes........
- Write about Semaphores. Explain its properties along with drawbacks.
- Write necessary conditions for arise of Deadlock.
- Define the following Terms: Mutual Exclusion, Thrashing, Thread
- Explain the features of Time sharing system.
- What is an operating system? Give the view of OS as a resource manager.
- Explain the following UNIX Commands: (a) grep (b) chmod (c) finger (d) cat (e) sort
- What is the thread? Explain thread Structure? And explain any one type of thread in detail.
- What is PCB? Discuss its major fields.
- List the four events that cause processes to be created. Explain each in brief.
- Explain the producer-consumer problem and its solution using the monitor.
- List Deadlock recovery techniques and explain any one of them.
- Write a short note in Critical Section.
- Explain context switching.
- Differentiate between Multi-Programming and Multi-Processing System.
- Write different types of system calls?
- What is a scheduler? Explain queuing diagram representation of process scheduler.
- Define the following Terms: Throughput, Waiting Time, Turnaround Time, Response Time.
- What is deadlock? List the conditions that lead to deadlock.
- Explain Banker’s algorithm for multiple resources with examples.
- What is Semaphore? Give the implementation of Bounded Buffer.
- What is Mutex? Write pseudocode to achieve mutual exclusion using Mutex.
- Explain the IPC problem. Explain the Dining Philosopher problem.