Process vs Thread

In this post, we will learn the difference between Process and Thread in Java. This is a frequently asked
question in Java interviews for beginners. Let's dive into it. 

Difference between Process and Thread in Java

Features Process Thread
Operation Weight Processes are heavy-weight operations. Threads are light-weight operations.
Memory Space Every process has its own memory space. Threads use the memory of the process they belong to.
Communication Inter-process communication is slow as processes have different memory addresses. Inter-thread communication is fast as threads of the same process share the memory address of the process they belong to.
Context Switching Context switching between processes is more expensive. Context switching between threads of the same process is less expensive.
Memory Sharing Processes do not share memory with other processes. Threads share memory with other threads of the same process.


Comments