Thread vs Process? What is difference between thread and process?

Threads Vs Process:

Here I have mentioned the basic difference between threads and process which is useful in many interviews. 

The process is the heavy weighted component. Each Process will execute in separate address space. It will not share memory and CPU time. Separate CPU time & memory will be allocated for each process. Processes can communicate to each other via InterProcess Communication (IPC). 

• Pipes
• Files
• Sockets

Thread is the light weighted component. The thread will be created inside the process. One process can have multiple threads to handle the different task. Different threads will share CPU time and memory allocated for the process. 

Context switching for a process is difficult than context switching for threads.

Process is protected from other processes via MMU (Memory Management Unit)
Threads can interfere with each other. 

Threads can be easily created while creation of new process required duplication of parent process

Threads can have control over other threads of a similar process while the process can have control over the child processes.

Change to the main thread will affect the other threads of the same process. while change to parent process doesn't affect child process.

Threads have direct access to a data segment of its own process. while process has its own copy of data segment of the parent process.

Concept took from & for more details please check

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 Unknown

"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


Post a Comment

Related Posts Plugin for WordPress, Blogger...