Difference between Process and Thread

By | October 7, 2021
Process and Thread

In technical interviews, one of the frequent questions is “What is the difference between thread and Process?”. Thread and Process are pretty much same and interrelated to each other that makes it so confusing to differentiate between threads and process.

Here in this article, we have given a brief description to differentiate tread and processes There are many definitions related to thread and process on the internet what we have provided here is a simple and sort explanation so you could understand the basic meaning and function of thread and processes.

Vamware

Before differentiating Process and Thread let’s have a brief introduction of both the term.

What is the Process?

When we execute or run a program it does not execute directly it takes some time because there are many steps to follow while a program executes.

The technical definition of a process is “When a program is in execution that means that the program has not executed yet, the following of all the program execution step is known as a process.”.

What is Thread?

The thread can be considered as a subset of Process, it is also termed as the lightweight process. In Computing a process is made up of multiple thread execution. Thread are small sequences of executions that occur during the process, these small executions of sequences made a process.

In an operating system, scheduler deals with the threads and assigned them resources so they could complete the work.  As the threads are the subset of the same process that’s why they share the same memory.

Difference between Process and Thread

Process

Thread

Definition

When a program is in execution that is known as Process Inside a process execution of small sequences is known as thread

Terminating Time

A Process takes more time to terminate Thread terminates quickly

Dependency

The process is independent by nature Threads are the subset of Processes they depend on the process

Information

The process contains all the instructions so it could follow all the instruction step by step. As threads are small and individual execution, they do not store much information about execution steps but they use process state and resource to follow the further steps.

Address Spaces

The process uses a desecrate range of memory address. Threads shear their address space.

Context Switching

Context Switching is slow in the process.

In context switching the state of execution is stored so it could restore and resumed from the last point of execution.

Threads take less time for context switching and quickly execute from the last point which has been stored.

Communication

In inter-process communication, it takes too much time to communication between two processes The thread can communicate quickly.

Blocked

In multiple processes, if one process is blocked the remaining process continues executing If a single thread gets blocked it’s all related threads would block too.

People Also Read:

Leave a Reply

Your email address will not be published. Required fields are marked *