Posts

Java Multithreading Interview Questions

In interviews, we usually come across two topics  Java Multithreading Interview Questions  and multithreading interview questions. Multithreading is all about concurrency and threads. It is good to be prepared, so do not leave this topic at all. We are sharing important java multithreading interview questions and answers. Q1.   What is a thread? The thread is a lightweight subprocess. Thread class belongs to a java.lang package. Threads have their own stack. It's a way to take advantage of multiple CPU available in a machine. For example, if one thread takes 50 milliseconds to do a job, you can use 10 threads to reduce that task to 5 milliseconds. Q2 What is the difference between Thread and Process? A process can have many threads. Threads can execute any part of the process. And the same part of Process can be executed by multiple threads. Processes have their own address while Thread shares the address space of the process that created it. Thread has its own stack w