The Benefits of Multithreaded Programming


Multithreading allows the execution of multiple parts of a program at the same time. These parts are known as threads and are lightweight processes available within the process. So multithreading leads to maximum utilization of the CPU by multitasking.

Some of the benefits of multithreaded programming are given as follows:

Multithreaded Programming
  1. Resource Sharing
  2. All the threads of a process share its resources such as memory, data, files etc. A single application can have different threads within the same address space using resource sharing.

  3. Responsiveness
  4. Program responsiveness allows a program to run even if part of it is blocked using multithreading. This can also be done if the process is performing a lengthy operation. For example - A web browser with multithreading can use one thread for user contact and another for image loading at the same time.

  5. Utilization of Multiprocessor Architecture
  6. In a multiprocessor architecture, each thread can run on a different processor in parallel using multithreading. This increases concurrency of the system. This is in direct contrast to a single processor system, where only one process or thread can run on a processor at a time.

  7. Economy
  8. It is more economical to use threads as they share the process resources. Comparatively, it is more expensive and time-consuming to create processes as they require more memory and resources. The overhead for process creation and management is much higher than thread creation and management.

    raja
    Published on 10-Oct-2018 20:12:21
    Advertisements