Home »
Java programming language
Java - Differences Between Process and Thread
By Preeti Jain Last updated : January 26, 2024
Process
A process is a running instance of a program.
Thread
A thread is a smallest segment of a process.
Process Vs. Thread
In the following table, we have listed the differences between process and thread in Java.
Process |
Thread |
Process is a part of operating System. |
Thread is also a part of operating System. |
Process is a heavy weight. |
Thread is a light weight process. |
Allocate space for processes are separated. |
Allocate space for threads are not separated it means it is sub part of processes. |
Every process are individual It means at the same time one process is downloading a file from internet resource and second process is user listening music in the background and third process user is working in a ms-office. |
Every Thread is not an individual It means Thread is independent part of the program (In other terms we can Thread is a sub part of the same program). |
There is no co-relation between the processes. Multiple processes can run simultaneously. |
There is co-relation between the threads.(In simple terms we have a large projects and in their several modules so what we can do with the help of thread concepts we can divide a large project into threads and thread will divided in a team to work on but basically we are trying to say it is a part of the project ). |
Every process required the resource to execute a program. |
Thread is recommended to improve performance and reduce throughput. |
A process has a virtual address space, executable code, open handles to system objects (i.e. in simple terms it allocates spaces for code, data, stack, registers etc). |
Thread is an entity within process that can be scheduled for execution. Threads also share its virtual address space and system resources. There are several responsibilities of threads like Exception handling, scheduling priority, Thread Local storage etc. |