Operating System Interview Questions · Question 04

What is the difference between a program and a process?

Interview preparation resource from Gate Smashers.

Interview-ready answer

A program is a passive file containing instructions, while a process is a running instance of that program with an execution state, memory, resources and an operating-system identity.

Diagram for What is the difference between a program and a process?
Understand it clearly

The executable stored on disk does not have a program counter, CPU registers or allocated runtime memory. When it is launched, the OS creates a process, maps the executable into an address space and prepares the stack, heap and other runtime structures.

The same program can create many processes. Opening a browser several times may run multiple process instances from the same executable, but every process has its own identifier and protected execution state.

For example, a browser executable is a program stored on disk. When you launch it, the OS creates a process with its own PID, address space, open files and scheduling information. Launching it again can create another independent process from the same program file.

Quick comparison
BasisProgramProcess
MeaningPassive instructionsProgram in execution
LocationStored as a fileLoaded and managed in memory
StateNo execution stateRegisters, stack, heap and status
InstancesOne executable definitionMany instances can use one program