I was given the question "what is difference between multi-processing and multi-threading" as an interview question. Today, I will not use big grammatical words to explain the differences between multi-processing and multi-threading to make it very easy for everyone to understand.
first, we need to understand these terms
Processor (CPU) is a chip that exists on the computer's mother-board, it executes the basic instructions that are given to it. It receives commands and perform the operations the user has requested. For example, the CPU processed the instructions to use a web browser to open and display this web page on your computer. refrence
Process is a program in execution.
Now that we have established the facts, let us get into the details.
Multi-processing
This is when a computer has two or more processors (CPUs). Todays' computers can have 2,4,8 CPUs. Device manufacturers leverage multiple CPUs to increase application performance and responsiveness (no lagging).
In multi-processors, we can run multiple programs (music app, gaming app, MS-word) at the same time.
Multi-threading
Firstly, a thread is a unit of a process.
Multi-threading means many threads run in the same parent process (program) at the same time. For example, using MS-word is a process (program), while using spell-check and copy-paste in MS-word is a thread.
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.
Differences between muti-processing and multi-threading
Mult-processing | Multi-threading |
---|---|
Multi-processing means a computer having two or more CPUs (processors) and it is able to run multiple programs at the same time. | Multi-threading means many threads run in the same parent process (program) at the same time. |
Multi-processing; a lesser amount of time is taken for processing a task (job). | Multi-threading; a moderate amount of time is taken for processing a task (job). |
Multi-processing executes many programs at the same time | Multi-threading executes many threads at the same time. |
Thank You, please follow me
Top comments (0)