Difference between threads and processes

  • Processes and threads are independent sequences of  execution ,the typical difference is that threads run in a shared memory space while processes run in separate memory spaces.
  • A process has self contained execution environment that means it has a complete, private set of basic run time resources particularly each process has its own memory space. Threads exist within a process and every process has at least one thread.
  • Each process provides the resources needed to execute a program. Each process is started with a single thread known as primary thread. A process can have multiple threads in addition to the primary thread.
  • Threads have direct access to the data segment of its process but processes have their own copy of the data segment of parent process.
  • Changes made to main thread may affect the behavior of the other threads of process while changes to parent process does not affect child process.
  • Processes are heavily dependent on system resources available while threads require minimal amounts of resource so a process is considered heavyweight while thread is considered a light weight process.