What is difference between Process and Thread?

Thread vs Process

  1. Thread is the subset of Process. A process can contain many threads in it.
  2. Thread share the memory address space & other resources which are allotted to the process by Kernel.
    • Thread will share file descriptor
    • The thread will share file system context.
    • Thread will share Signal handling
    • Most Processes will not share file descriptor
    • Processes will not share file system context.
    • Processes will not share Signal handling
  3. A Thread can directly communicate with other thread. A Process can communicate with other process using Inter Process Communication mechanism (IPC). Thread communication considerably simple & easy than Process communication. (Socket, Pipe, Message Queue, Shared Memory are the example of IPC)
  4. We can say thread have no overhead while process have considerable overhead.
  5. A thread can have control over other thread of the same process while the process can control its child process.
  6. A Change to the main thread can affect the other thread while change to parent process can not affect the child process.
  7. A thread can be considered as light weighted Process or component. 

Related Post:

Removing Space from Given String & Different Methods to Count Number of Ones in Given Value

Booting Sequence for Boot Process in Linux

How to count number of 1 or set bits in a given number

What is Segmentation fault?

How to Access Private Data Members in C++ without using friend function

Process Vs Thread 

How to Add Two Numbers Without Using + Operator in C 

Overview of Function Pointer in C with Example - What is function pointer & how to use it

How to Fork child process with waitpid & execl in Linux with c example code

Share on Google Plus

About Kapil Thakar

"I am Kapil Thakar, an Embedded Engineer cum Blogger wants to learn new things. I love to share my knowledge solutions to the problems. Interested in Blogging, Creative-Writing, SEO, Website Creation, Video Making, Editing, Affiliation Programs, Online Making Money."
    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment

Related Posts Plugin for WordPress, Blogger...