Executing multiple tasks at the same time is called multi tasking . Here task can be program . Even multi tasking and multi processing words are being used for meaning , there is a little difference . Multi processing implies that more than one CPU is involved. In multitasking, only one CPU is involved . In multitasking, CPU switches from one program to another so quickly . So, it appears as all of the programs run at the same time. In multi taking, two types of multi tasking are there .
1) Process based multitasking
2) Thread based multitasking
Process based multitasking :
Executing multiple tasks simultaneously , where each task is a separate process ( program ) is called Process based multitasking . In Process based multitasking , each process will have it’s own area of memory. For example , playing video games while also listening songs.
Thread based multitasking :
Executing multiple tasks of the same process ( program ) simultaneously is called Thread based multitasking . An independent path of execution of a process is called Thread . In Thread based Multitasking , all threads share same memory addresses. Switching between (Context switching) Threads is less expensive than switching between processes.
whether it is Process based multitasking or Thread based multitasking the main objective of multitasking is to improve performance. Java provided inbuilt support for multi threading by providing rich API .