Java- Multithreading in java - JavaTechWorld

Tuesday, 6 June 2017

Java- Multithreading in java

Hi Guys, Before understanding multithreading let us quickly review multitasking.

Multitasking and types of multitasking -
Executing multiple tasks at a time is called multitasking.
Ex: while typing we can download a file, we can listen to music. It is called multitasking

Multitasking is of two types -
  1. Process based multitasking
  2. Thread based multitasking
Process based multitasking 
Executing multiple tasks simultaneously is called process based multitasking here each task is a separate independent process.

Thread based multitasking
Executing multiple tasks concurrently is called thread based multitasking here each task is a seperate independent part of a single process. That part is called thread.

Advantage of multitasking
it is a process based or thread based multitasking the advantage of multitasking is to imporove the performance of the system be decreasing the response time.

The difference between multitasking and multithreading
Multitasking is a heavy weight because switching between contexts is slow because each process is stored at seperate address 

Multithreading is a light weight because switching between contexts is fast because each thread is stored in same address.

© 2014 JavaTechWorld. Designed by Bloggertheme9
Powered by Blogger.