Benefits of Multithreading

Benefits of Multithreading

  1. Responsiveness
  2. Resource sharing, hence allowing better utilization of resources.
  3. Economy. Creating and managing threads becomes easier.
  4. Scalability. One thread runs on one CPU. In Multithreaded processes, threads can be distributed over a series of processors to scale.
  5. Context Switching is smooth. Context switching refers to the procedure followed by CPU to change from one task to another.
Multithreading Models | Many-To-One Model | One-To-One Model | Many-To-Many Model

Multithreading Models

The user threads must be mapped to kernel threads, by one of the following strategies.

  • Many-To-One Model
  • One-To-One Model
  • Many-To-Many Model

Many-To-One Model

  • In the many-to-one model, many user-level threads are all mapped onto a single kernel thread.
  • Thread management is handled by the thread library in user space, which is efficient in nature.

Many to One thread model

One-To-One Model

  • The one-to-one model creates a separate kernel thread to handle each and every user thread.
  • Most implementations of this model place a limit on how many threads can be created.
  • Linux and Windows from 95 to XP implement the one-to-one model for threads.

One to One thread model

Many-To-Many Model

  • The many-to-many model multiplexes any number of user threads onto an equal or smaller number of kernel threads, combining the best features of the one-to-one and many-to-one models.
  • Users can create any number of the threads.
  • Blocking the kernel system calls does not block the entire process.
  • Processes can be split across multiple processors.

Many to Many thread model

Thread Models

There are four kind of thread models:

(i) User level single thread process model

(ii) User level multiple thread process model

(iii) Kernel level single thread process model

(iv) Kernel level multiple thread process model