Explain following multithreading models with advantages and disadvantages (i) Many to one (ii) Many to Many | Operating System Question & Answer

Many to One Model:

 This model maps many user level threads to one kernel level thread. 
 If user level thread generates blocking system call then it blocks an entire process.
 At a time only one user level thread can access kernel level thread i.e multiple threads can’t execute in parallel.
 Thread management is done by Thread libraries.
 Example: - Green threads – a thread library available for Solaris use many-to-one model.

Advantages:-
 It is an efficient model as threads are managed by thread library in user space. 
 Portable: Because user level threads packages are implemented entirely with standard Unix and POSIX library calls, they are often quite portable. 
 One kernel level thread controls multiple user level threads.
 Easy to do with few system dependencies. 

Disadvantages: 
 One block call from kernel level thread blocks all user level threads.
 Cannot take advantage of multiprocessing. 

One to One Model:

 The one to one model maps each user thread to a single 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.
 Whenever user level thread is created, it compulsorily creates corresponding kernel level thread.
 This model is used in Linux & Windows version like 95,97,XP, NT. 

Advantages:  
 It allows multiple threads to run in parallel on multiprocessors.
 More concurrency
 Less complication in processing 

 Disadvantages:
 Creating a user thread requires creating the corresponding kernel thread. Creating kernel thread may affect the performance of an application. 
 It reduces performance of the system.
 Kernel thread is overhead. 

Post a Comment

0 Comments