Multithreading in Java
## Why "Multithreading & Multiprocessing"
- to achive multitasking
-
## In a nut shell..
- Threads use shared memory area
- Threads => Faster Control Switching
- A Thread is lightweight whereas a process is heavyweight
For Example, A word processor can have one thread running in foreground as an editor and another in the background for autosaving the document.
## Flow of control in Java
1. Without threading:
2. With threading:
## Creating a Thread:
1. By extending Thread class
2. By implementing Runnable interface
### Life cycle of a Thread

Comments
Post a Comment