Difference Between Multiprocessing and Multithreading

Several processes are running at a time in a computer system.. The operating system allocates resources to the processes and it is necessary to increase CPU utilization. Multiprocessing and multithreading can affect system performance. The key difference between multiprocessing and multithreading is that, in multiprocessing, multiple processes are running concurrently using two or more processors whereas, in multithreading, multiple threads in a process are running concurrently. This article discusses the difference between multiprocessing and multithreading.

CONTENTS

1. Overview and Key Difference
2. What is Multiprocessing
3. What is Multithreading
4. Similarities Between Multiprocessing and Multithreading
5. Side by Side Comparison – Multiprocessing vs Multithreading in Tabular Form
6. Summary

What is Multiprocessing?

Multiprocessing is to run multiple processes using two or more processors concurrently. There are different types of multiprocessing mechanisms. They are Symmetric Multiprocessing and Asymmetric Multiprocessing.

Figure 01: Symmetric Multiprocessing

In Symmetric Multiprocessing, each processor has their own cache and all processors are connected using a shared bus. As there is a shared memory, all processors are sharing the same memory address space. One limitation of this method is when the number of processors increases it might get slow in accessing main memory. Processors are free to run any process on the system.

In Asymmetric multiprocessing, processors perform according to master-slave architecture. Master processor allocates processes for slave processors.

What is Multithreading?

Multiple processes are running on a computer system at the same time. A process is a program in execution. Working in MS Word can be considered as a process. While using MS Word, the grammar and spelling are checked. It is a subprocess or a subtask.  In that way, the main process is divided into subprocesses. These subprocesses are units of the process and they are known as threads. Therefore, a process is similar to a task and a thread is a unit of a process.

A thread consists of the program counter, thread counter, register set, thread ID, and stack. Creating processes for each task is not an effective method. Therefore, a process is divided into multiple threads. These multiple threads are running on the process at the same time. This concept is known as ‘Multi-threading’.

Figure 02: Multithreaded Process

There are some advantages in Multi-threading. Each thread in a process is sharing the same code, data and resources. It is not necessary to allocate resources to each thread separately so using threads are economical. If one thread fails, that will not affect the process. Threads are light-weight and consume the minimum amount of resources compared with a process.

What are the Similarities Between Multiprocessing and Multithreading?

  • Both methods can increase CPU utilization.
  • Both methods can increase computing speed.

What is the Difference Between Multiprocessing and Multithreading?

Multiprocessing vs Multithreading

Multiprocessing is to execute multiple processes using two or more processes concurrently to improve the system performance. Multithreading is to execute multiple threads in a process concurrently to improve system performance.
 Execution
In Multiprocessing, multiple processes are running concurrently. In Multithreading, multiple threads in a single process are running concurrently.
Resource Requirements
Multiprocessing requires more resources. Multithreading does not require many resources; therefore, it is more economical.

Summary – Multiprocessing vs Multithreading 

Multiprocessing and multithreading can affect the computer performance. The difference between Multiprocessing and Multithreading is that, in multiprocessing, multiple processes are running concurrently using two or more processors and, in multithreading, multiple threads in a single process are running concurrently. To increase speed and CPU utilization, multi-threading can be implemented on multiprocessors.

Download the PDF Version of Multiprocessing vs Multithreading

You can download PDF version of this article and use it for offline purposes as per citation note. Please download PDF version here Difference Between Multiprocessing and Multithreading

Reference:

1.“Asymmetric multiprocessing.” Wikipedia, Wikimedia Foundation, 14 Dec. 2017. Available here 
2.“Symmetric multiprocessing.” Wikipedia, Wikimedia Foundation, 11 Dec. 2017. Available here
3.Point, Tutorials. “Operating System – Multi-Threading.”, Tutorials Point, 15 Aug. 2017. Available here  
4.“Difference between Multiprocessing and Multithreading.” YouTube, YouTube, 5 Sept. 2016. Available here

Image Courtesy:

1.’Multithreaded process’By I, Cburnett, (CC BY-SA 3.0) via Commons Wikimedia