A program is a passive entity (an executable file residing on disk), whereas a Process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources. A program becomes a process when an executable file is loaded into memory.
When a process is loaded into memory, it is divided into several sections:
As a process executes, it changes state. The state of a process is defined by its current activity:
Each process is represented in the operating system by a Process Control Block (PCB), also called a task control block. It contains crucial information about the specific process:
When an interrupt or system call occurs, the OS needs to save the current context of the running process on the CPU so that it can restore that context when its processing is done. This process of saving the state of the old process and loading the saved state for a new process is known as a Context Switch. Context switch time is pure overhead, because the system does no useful work while switching.