Clicky

Processes vs Threads in Java

  • A program in execution is often referred as process. A thread is a subset(part) of the process.
  • A process consists of multiple threads. A thread is a smallest part of the process that can execute concurrently with other parts(threads) of the process.
  • A process is sometime referred as task. A thread is often referred as lightweight process.
  • A process has its own address space. A thread uses the process’s address space and share it with the other threads of that process.
  • A thread can communicate with another thread (of the same process) directly by using methods like wait(), notify(), notifyAll(). A process can communicate with other process by using inter-process communication.
  • New threads are easily created. However, the creation of new processes require duplication of the parent process.
  • Threads have control over the other threads of the same process. A process does not have control over the sibling process, it has control over its child processes only.