Introduction to Operating Systems: Unit II(a): Process Management

Multithread Models

Process Management - Introduction to Operating Systems

Operating system uses user level thread and kernel level thread. User level threads are managed without kernel support. Operating system support and manage the kernel level threads.

Multithread Models

• Operating system uses user level thread and kernel level thread. User level threads are managed without kernel support. Operating system support and manage the kernel level threads.

• Modern operating system support kernel level threads. Kernel performs multiple simultaneous tasks in operating system. In most of the application, user threads are mapped with kernel level threads.

• Different methods of mapping is used in operating system are as follows:

1. One to one

2. Many to one

3. Many to many

1. One to one

• In this model, one user level thread maps with one kernel level thread. If there are three user threads then system creates three separate kernel thread. This model provides more concurrency because of separate thread. Fig. 2.9.1 shows one to one mapping.

• In this method, the operating system allocates data structure that represents kernel threads. Here multiple threads are run in parallel on multiprocessor system.

• Number of threads in the system increases, the amount of memory required is also increases.

• Windows 95/XP and Linux operating system uses this one to one thread mapping.

• Only overhead in this method is creation of kernel level thread for user level thread. Because of this overhead, system performance is slowdown.

2. Many to one

• Many to one mapping means many user thread maps with one kernel thread. Fig. 2.9.2 shows many to one mapping.

• Operating system blocks the entire multi-threaded process when a single thread blocks because the entire multi-threaded process is a single thread of control. So when operating system re receive any a blocking I/O request, it blocks the entire

• Thread library handle thread management in user space. The many-to-one model does not allow individual processes to be split across multiple CPUs.

•This type of relationship provides an effective context-switching environment, easily implementable even on simple kernels with no thread support.

• Green threads for Solaris and GNU portable threads implement the many-to-one model in the past, but few systems continue to do so today.

• Advantage: System performance is improved by customizing the thread algorithm.

3. Many to many

• In the many to many mapping, many user-level threads maps with equal number of kernel threads. Fig. 2.9.3 shows many to many thread mapping.

• Many to many mapping is also called M-to-N. thread mapping. Thread pooling is used to implement this method.

• Users can create required number of thread and there is no limitation for user. Again here blocking Kernel system calls do not block the entire process.

• This model support for splitting processes across multiple processors.

Limitations: Operating system design becomes complicated.

Example 2.9.1: Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution.

Solution:

a. A Web server that services each request in a separate thread.

b. A parallelized application such as matrix multiplication where different parts of the matrix may be worked on in parallel.

C. An interactive GUI program such as a debugger where a thread is used to monitor user input, another thread represents the running application, and a third thread monitors performance.


University Question

1. Explain with a neat diagram about various multi threading models.  AU May-22, Marks 6

Introduction to Operating Systems: Unit II(a): Process Management : Tag: : Process Management - Introduction to Operating Systems - Multithread Models