• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
June 02, 2022 |78.4K Views

Process vs Threads in Operating System

  Share  1 Like
Description
Discussion

In this video, we have covered in detail what is the difference between a Process & Thread.

A process is a program in execution, the program resides in secondary memory and is a static entity, whereas when the same program gets executed it comes to the main memory for execution and is known as a process. A process is an independent entity existing on its own. A process can be in any of the seven states, i.e., new, ready, run, terminated, wait, suspend ready, or suspend block. Each process has a process control block associated with it. And each process is allocated with the required resources by the operating system, and those resources are not used by any other process at the same time.

A process is heavyweight in nature as it has resources associated with it, therefore it needs more time to create a process. A process requires more context switching time and more termination time. Due to unshared resources, communication is less efficient among processes. A process can create one or more threads and it contains its own code, data, stack space, address space, and other resources. A process never affects any other process. It requires more resources as compared to a thread.

Process management requires more system calls.

Thread: A thread is a part of a process. A single process can have multiple threads, a thread is a dependent entity as it is dependent on a process for its existence. Thread share the same set of resources among a process. A thread has only three states, i.e. Ready, run, and Block.

Each thread is associated with a thread control block.
As it is said that a thread is a part of a process, hence it is very lightweight in nature and therefore requires very less creation time. Context switching time is also very less because fewer or zero resources are associated with a thread. It also has less termination time. Due to shared resources communication is very efficient among threads of a single process, a thread cannot create one or more processes whereas a process can create multiple threads. Multiple threads share the same data, code, stack space, address space, and other resources of its parent process with other threads present in the process.

Blocking of single user-level threads can lead to blocking of all other user threads. Due to lightweight architecture, a thread requires a very less number of resources than a process. Thread management requires very fewer system
calls.

Process vs Thread: https://www.geeksforgeeks.org/difference-between-process-and-thread/