CREATE OWN LIBRARY

Difference between Program and Process

 

Program is an instructional part or entity and the process is the execution of the program. 

 

Program generally resides in hard disk and when we try to execute the program, OS create a process for the program and load it to RAM. 

 

Example: 

 

 

But when we try to execute a.out, then OS load it to RAM (Main memory) and create a structure for it as below:

 

Fig: 8

 

Actually, a process is more than the program code, which is sometimes known as the text section.

 

It also includes the current activity, as represented by the value of the program counter and the contents of the processor’s registers. A process generally also includes the process stack, which contains temporary data (such as function parameters, return addresses, and local variables), and a data section, which contains global variables. A process may also include a heap, which is the memory that is dynamically allocated during process run time. The structure of a process in memory is shown in the above figure.