Multithreading Models in OS

Multithreading Models in OS:- A relationship must exist between user threads and kernel threads. In this article, we look at three common ways of establishing such a relationship. Demand Paging in OS

 

Multithreading Models in OS

 

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 userspace, 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 run in parallel on multiprocessors. Green threads-a thread library available for Solaris -uses this model, as does GNU Portable 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, implements the one-to-one model.

 

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). Whereas the many-to-one model allows the developer to create as many user threads as she wishes, true concurrency is not gained because the kernel can schedule only one thread at a time. 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-any model Suffers from neither of these shortcomings developers can create as many users 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.

One popular variation on the many-do-many model still multiplexes manty ser-level reads to a smaller or equal number of kernel threads but also allows a user-level thread to be bound to a kernel thread. This variation is sometimes referred to as the two-level model is supported by operating systems such as IRD, HP-X, and Tru64 UNIX. The Solaris operating system supported the two-level model in versions older than Solaris 9. However, beginning with Solaris 9, this system uses the one-to-one model.

Leave a Reply

Your email address will not be published.