Program, Process and Threads are three basic concepts of the operating systems about which every computer science engineer must be familiar with. Here, I will explain what each of them is all about and how they differ from each other.
What is a program?
A program is an executable file containing the set of instructions written to perform a specific job on your computer. For example, notepad.exe is an executable file containing the set of instructions which help us to edit and print the text files.
Programs are not stored on the primary memory in your computer. They are stored on a disk or a secondary memory on your computer. They are read into the primary memory and executed by the kernel. A program is sometimes referred as a passive entity as it resides on a secondary memory.

What is a process?
A process is an executing instance of a program. For example, when you double-click on a notepad icon on your computer, a process is started that will run the notepad program.
A process is sometimes referred as an active entity as it resides on the primary memory and leaves the memory if the system is rebooted. Several processes may be related to the same program. For example, you can run multiple instances of a notepad program. Each instance is referred as a process.

What is a thread?
A thread is the smallest executable unit of a process. For example, when you run a notepad program, the operating system creates a process and starts the execution of the main thread of that process.
A process can have multiple threads. Each thread will have their own task and own path of execution in a process. For example, in a notepad program, one thread will be taking user inputs and another thread will be printing a document.
All threads of the same process share memory of that process. As threads of the same process share the same memory, communication between the threads is fast.
Summing up…

Hope by now, you are clear about the differences between program, process and thread and also have discovered the relationship between them… If not, find out below.

A program is a superset of the process, whereas, a process is a superset of a thread.
Enjoy Learning!!!
Comments
Post a Comment