Multithreading:

Multithreading means having multiple threads of execution within the same application. Each thread is like a separate CPU executing different parts of the code simultaneously.

Reasons for using multithreading:

  • Better utilization of a single CPU.
  • Better utilization of multiple CPUs or CPU cores.
  • Improved user experience in terms of responsiveness.
  • Enhanced fairness in handling tasks.

Multitasking && Multithreading

multiprocessing: Multiple processors/CPUs executing concurrently.

Multitasking: Multiple processes running concurrently on a single CPU. The OS handles this process by switching between tasks.