Posts

Showing posts with the label Multithreading in Java

Multithreading Concept in Java

Image
MULTITHREADING  in Java : it is a process of executing two or more threads simultaneously to maximum utilization of CPU. Or Multithreading  is a process of executing multiple threads simultaneously. A thread is a lightweight sub-process, the smallest unit of processing. There are two types of thread –  user level thread : These threads are managed by users. Kernel level (daemon thread) :- These threads are managed by operating system. Threads are used when we want to clean the application and are used in the background. Advantages of Java Multithreading 1) It  doesn't block the users .(provides efficient communication between users) 2) You  can perform many operations together at the same time , so it saves time . 3) Threads are  independent , so it doesn't affect other threads if an exception occurs in a single thread. 4.Threads minimize the context switching time. Life Cycle of a Thread(Thread states) : A thread goes through various stage...