Benefits of Multithreaded Programming

Q1. What are the benefits of Multithreaded Programming?

The benefits of multithreaded programming can be broken down into four major categories:

  1. Responsiveness

Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation, thereby increasing responsiveness to the user.

For instance, a multithreaded web browser could still allow user interaction in one thread while an image was being loaded in another thread.

  1. Resource sharing

By default, threads share the memory and the resources of the process to which they belong. The benefit of sharing code and data is that it allows an application to have several different threads of activity within the same address space.

  1. Economy

Allocating memory and resources for process creation is costly. Because threads share resources of the process to which they belong, it is more economical to create and context-switch threads. Empirically gauging the difference in overhead can be difficult, but in general it is much more time consuming to create and manage processes than threads.

In Solaris, for example, creating a process is about thirty times slower than is creating a thread, and context switching is about five times slower.

  1. Utilization of multiprocessor architectures

The benefits of multithreading can be greatly increased in a multiprocessor architecture, where threads may be running in parallel on different processors. A single threaded process can only run on one CPU, no matter how many are available.

Leave a Reply

Your email address will not be published. Required fields are marked *

10 Views
%d bloggers like this: