Tuesday, March 27, 2007

Program vs. Process

These two concepts have been always confusing me. Many say both are same. Recently when I was reading the 'Modern Operating Systems' book I found a clear explanation of the difference between the two.

A program is simply an algorithm. A process is an activity. It includes a program, input, output and a state. Or in other words a process is the execution of a program (an algorithm).

The book includes a nice illustration of a computer scientist. 'He is baking a cake for his daughter. He has the recipe and ingredients: flour, eggs, sugar, extract of vanilla... The recipe is the program, the scientist is the processor(CPU), and the cake ingredients are the input data. In this illustration, the process is the activity of scientist reading the recipe, fetching the ingredients, and baking the cake.'