Program vs Process: Brutal Comparison with 4 Differences

Program vs Process: what are the differences and the similarities? Learn more with this guide about their differences

Share This Post

Program vs process, what is the difference? If you are studying computer architecture or operating systems, you need know this difference. In fact, while program and process are so similar that they are often used interchangeably, they are not the same. In this quick guide, we explain what is the difference between program vs process in Information Technology.

To better understand “program vs process”, you should be familiar with Operating Systems. If you aren’t, don’t worry – you can quickly catch up with this comprehensive Computer Architecture guide in 10 minutes or so.

Program vs Process Explained

What is a Program?

In a computer, a program is a set of instruction that tells the computer what to do. It tells how to use the hardware to do things that are useful to humans. For example, a videogame may instruct the computer on how to render a beautiful landscape on the screen and how to interpret each button pressed on the keyboard and translate it into the movement of a character. Microsoft Excel may tell how to use the CPU to perform calculation between cells in the spreadsheet, and so on.

A program is a set of instructions that tells the computer what to do. It is like a recipe, a set of steps.

A program can be simple or complex, but it is always a set of instructions that is always the same. How can it be the same if the outcomes always change? For example, in the videogame I may move the character to some new area, and in Excel I can create many different files with different purposes. However, the underlying program is always the same.

A program tends to transform some input (key strokes, data in cells and so on) into some output (character movement in the videogame, calculations in Excel). So, the output is dependent on both the input and the program itself. If you change the input, you will get a different output even if the program remains the same.

Therefore, the program is just a set of instruction, and it remains always like that. It is like a recipe to bake brownies, it is just a set of steps “do this, then do that”.

What is a Process?

If a program is like a recipe, it won’t be of much use unless we start cooking. The process is nothing more than the cooking process, following the “program” recipe. While the recipe is one and stays the same potentially forever, the cooking changes every time. Having a process means taking the recipe and putting it into practice.

If you studied Operating System, you know that for a computer to execute some instructions, that instruction must be present in the RAM memory. This is exactly what a process is:

A process is a program copied from disk to RAM for execution.

However, a process does not have to be in RAM, not necessarily at least. Computers and operating systems are complex beasts, and they may decide to store the process itself in the hard disk (permanent storage) for a while, then put it into RAM, then put it back to disk and so on. How can you distinguish a process in the disk from a program in the disk? To answer that, it is time to dive into the differences of program vs process.

Program vs Process: The Differences

Program vs Process: Properties

The first difference between program and process relates to properties, or context. In short, a program does not have any, while a process will have some properties. For sure, a process will have a Unique Identifier (UID), which the operator assigns to it when the process is spawned. This UID, formally known as Process Identifier or PID is unique in the entire system. That is, no two processes will have the same PID at the same time in the same system.

In addition, the process has some other properties such as burst time (or execution time) as well as Input-Output time (I/O time). Those are properties that specifically relate to the fact that the process is in execution, they would make no sense in a program that is only sitting idle on the disk waiting to be executed.

When you want to execute a program, such as Microsoft Word, Adobe Photoshop, or Google Chrome, the Operating System simply takes that program and spawns a process from that. This means copying the program into RAM or disk and adding PID and properties.

Program vs Process: Memory

This is simple: a program will never be inside the RAM, while a process will be. In fact, for a process to be useful (that is, to be executed), it must be in the RAM.

Program vs Process. one resides in RAM while the other in disk
Processes are placed in RAM, which is directly connected to the CPU, unlike disk that hosts programs.

This is because the CPU, the part of the computer that executes instructions, can only read instructions and data that are present in the RAM, and not those present in the permanent disk. In fact, RAM is orders of magnitude faster than disk or SSD, and it is connected to the CPU in a different way. Another thing to remember is that RAM is non-persistent, any data stored in RAM will be lost when you power-off the device. On the other hand, disk or SSD are slow but permanent.

This is the reason you want to keep your programs (recipes) into the disk, and spawn processes in the RAM only when you want to execute them. This is the difference in memory usage between program and process.

Program vs Process: Role

We can reiterate a little bit on the different role that a process has compared to a program. In the end, this is the key difference, any other difference comes as a consequence of this.

A program is like a blueprint, a set of general instructions on how to deal with data, how to process it and transform it into useful output. It is a recipe, a list of steps to take and a list of if-then statements.

A process is putting this blueprint in motion, is about taking the resources needed as input (files, pictures, input from users on the keyboard or through the mouse) and doing something with them according to the instructions written in the program. No program is useful unless it spawns a process to be executed at some point.

Bonus: The Operating System

Even the operating system is a program, or rather a set of programs, with specific goals in mind. The goal of the operating system is to manage resources efficiently: allocate RAM, CPU, disk and other hardware components to processes in a smart way, as well as providing other processes a convenient way to interact with hardware.

Because of this, the operating system starts as a program on the disk, which is immediately loaded as the first process in the RAM when the system boots up. Then, this process decides how to spawn other processes, how to allocate resources to them, and how to eventually terminate them.

Program vs Process in Summary

In summary, a program is a set of instructions for a computer to follow; a process is the act of executing those instruction. This translate into a program being static and stored in the RAM, waiting for a process to be born out of it. When this process is born, it is placed in RAM and assigned with a Process ID (PID) and some other context properties.

Programs and processes are tightly linked, but they have their differences. To better understand them, dive deeper into Computer Architecture with this no-bullshit guide.

Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded ICTShore.com with the same principle: I share what I learn so that you get value from it faster than I did.
Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded ICTShore.com with the same principle: I share what I learn so that you get value from it faster than I did.

Alessandro Maggio

2022-01-20T16:30:00+00:00

Opportunity

Dev

1300