Hello Readers! In this post, we will learn about Multitasking, Multithreading and Multiprocessing. We will also see the difference between Multitasking, Multithreading and Multiprocessing.
Multitasking is a logical extension to multiprogramming. It allows CPU to perform multiple tasks such as program, process, task, threads etc. To perform Multitasking, the CPU switches among these tasks very frequently. In Multitasking, user can interact with each program simultaneously.
In real world system, we can listen music, do browsing and work on excel simultaneously.
Multitasking provides the fundamental mechanism for an application to control and react to multiple, discrete real world events. Therefore, it is essential for many real-time applications. A multitasking environment allows application to be constructed as a set of independent tasks.
A thread is a basic unit of CPU utilization. Multithreading is a different from multitasking that allows multiple tasks at the same time, whereas the multithreading allows multiple threads of single tasks to be processed by CPU at the same time. Multithreading is thread based multitasking. It allows multiple threads of the same process to execute simultaneously.
An example would be a web server, where the responses to all the incoming requests need much of the same program logic and state, but different handles on a few things (network socket and id of caller) etc. Another is VLC media player, where one thread is used for opening the VLC media player, one for playing a particular song and another thread for adding new songs to the playlist.
Multithreading increases responsiveness. One program contains multiple threads. So, if one thread is taking too long to execute or if it gets blocked, the rest of the thread keep executing without any problem. Multithreading is less costly. Creating a new process and allocating resource is a time consuming task but in a one process allocating multiple threads and switching between them is comparatively easier.
A multiprocessing system is one which has more than two processors. The CPUs are added to the system to increase the computing speed of the system. Since there are multiple processors available, multiple processes can be executed at a time. These multiprocessors includes computer bus, memory and peripheral devices.
Multiprocessing systems can be divided in two types –
(a) Symmetric Multiprocessing: The operating system here resides on one processor and the other processors run user’s programs.
(b) Asymmetric Multiprocessing: The operating system on any available processor or all the processor simultaneously run the user program.
It refers to the hardware rather than software. In multiprocessing, throughput is maximum.
That’s end of tutorial on Multitasking, Multithreading and Multiprocessing.