Wednesday, July 23, 2014

MultiThreading in Java



Multi threading:-
It is light weight which is use in gaming
·         It executes multiple threads simultaneously at a time.
·         Thread is a light wait it takes small unit of time of processing.
·         Multithreading is a achieving of multitasking because of multithread share common memory area
·         They do not allocate separate memory to thread.
·         Context switch get less time to make processing them.
Multitasking types
1:- process based
2:- thread based

1:- process based multitasking:-

·         Each process has its own address in memory process allocate separate memory area .so it takes time to save process in memory area.
·         Cost of communication is high
·         Switch for one process to another then it take time to saving process in memory.

2:- Thread based multithreading:-

·         Thread have same address space
·         Cost communication is low
·         Thread is light weight.

Note: - each process required one thread.

Thread is light weight sub process it take separate path of execution it share separate area of memory execution

MultithreadingProcess
Life cycle of thread :-
  1. New
  2. Runnable
  3. Running
  4. Non-Runnable (Blocked)
  5. Terminated



No comments:

Post a Comment