Difference between Process and Thread. Thread vs Process.

 


Thread Process
An executing instance of a program is called a process. A thread is a subset of the process.
Thread shares the address space of process that they are belonging to. Processes have their own address space.
Threads have direct access to the data segment of its process. Processes have their own copy of data segment of a parent process.
Threads can directly communicate with other threads of its process. The processes must use interprocess commumnication (IPC) to communicate with other process.
Threads have less overhead with context switching. Processes have considerable overhead.
New threads can be easily created. New process requires duplications of a parent process.
Threads can exercise a considerable control over threads of a same process. Process can only exercise control over its child process.
Changes to the main thread may affect the behaviour of other threads of a process. Changes to the process does not affect the child process.
Threads (of the same process) run in a shared memory space. Processes run in separate memory spaces.
Every thread is not a process. It is a part(entity) of a process. Every process is a thread (primary thread).
Threads are light weight processes. Threads are bundled inside the process. Process is a heavy weight process.
Threads are created using clone() method. Process are created using fork() method.