Loading

A process of executing multiple tasks simultaneously is known as Multitasking. It is of two types.


Types of Multitasking

1. Process-Based Multitasking 
2. Thread-Based Multitasking



Process-Based Multitasking

It is executing multiple processes at the same time, where each process runs independently with it's own allocated resources.

Characteristics

  • The process is a heavyweight.
  • The high communication costs involved in the process.
  • Each process allocates a separate memory area i.e. each process has an address in memory.
Example: Running a video player while using a web browser.


Thread-Based Multitasking

It is executing multiple threads within a single process

Characteristics

  • Thread is a small unit of processing that operates as a lightweight sub-process..
  • The cost of communication between the Thread is low.
  • It uses a shared memory area, they don't allocate separate memory areas so Threads saves memory.
  • Thread is independent. If any exception occurs in one Thread it doesn't affect another thread.
Example: In a web browser, one thread handles UI rendering, while another thread manages network requests.

Comparison Between Process-Based Vs. Thread-Based Multitasking

FeatureProcess-Based MultitaskingThread-Based Multitasking
DefinitionRunning multiple processes at a timeRunning multiple threads within a process
Memory
Allocation
Every process has own address spaceThreads share memory
Resourcehigh (Each process is independent)
Low (Shared memory)
Communication CostHigh Low
SpeedSlowFast
ExampleMultiple applications (Word + Browser)Multiple threads in a single app (UI + Network in a browser)