Multi-Threading in Java

Executing multiple tasks in Java together is a concept of multitasking, there are two types of multi-tasking –

  • Process Based Muti-Tasking
  • Thread Based Multi-Tasking

Process Based Multi-Tasking

Executing several tasks simultaneously where each task is a separate independent program is called a process-based multitasking process.

For Example- While using our smartphone we can listen to songs and use browsers together these two tasks are separate and independent of each other, Hence it is process-based multitasking. This type of multitasking is best suitable at the operating system level.

Thread Based Multi-Tasking

Executing the same tasks simultaneously where each task is a separate independent part of the same program is known as Thread Based Multi-tasking. Thread Based Multi-tasking is best suitable at the programing level.

Whether it is thread-based or process-based multi-tasking the advantage of multi-tasking is to reduce response time and improve performance.

Multi-Tasking in Java

While comparing with old programming languages developing a multi-thread application in Java is very easy because there is inbuilt support for multi-threading with rich API (Thread, Runnable, etc) available in Java.

Similar Java Tutorials

Leave a Comment