What is Process ?

When we start to study the process management in os then first question that comes in mind is what is process and what is difference  between program and process?
So let me clear the answer of this question process is nothing but process is a program in execution.Process is an active entity where as program is  a passive. The term program is used when user data or instruction is on disk but as soon as program is loaded into memory for execution it becomes a process.

Now come to the further discussion to understand the process management in os.

How a process can be represented in memory ?

So  when a program is loaded into the memory and it becomes a process now in memory process can be represented by using  four sections ─ stack, heap, text, and data. This is also known as abstract view of process.
Figure 1 represents layout of a process inside main memory.
operating system study materail
Let  see each part one by one –
      Stack: Stack contains the temporary data such as method/function parameters, return address, and local variables related to a process.
       Heap: Heap is a  dynamically allocated memory to a process when process is under execution.
Text: Text section of  the process tells about  the current activity which is  represented by the value of Program Counter and the contents of the processor’s registers.
Data: Data section contains the global and static variables.

Process states in operating system

When a process is created and when it terminated from beginning to end during its life cycle a process can remain in many states. Different process states in operating system are represented in following process state transition diagram in operating system.
Figure 2 represent State Transition diagram for a process
operating system study material
Let see these state one by one.
Start or New: First state is Start or new  state. A process is said to be in new state when it is  started or created.
Ready:It is the state next to new state .  The process is said to be in ready state when it is waiting to be assigned to a processor. Ready processes are waiting to have the processor allocated to them by the operating system so that they can run.

A process may come into ready  state in  three situation first is just after the Start state, second situation may be  while running and getting interrupted by the scheduler to assign CPU to some other process in this situation it comes to ready state so that cpu can execute the new process. Third situation from wait state when I/O is completed or wait for an even is completed.

Running: Once the process has been assigned to a processor by the OS scheduler, the process state is set to running and the processor executes its instructions then process is said to be in running state.
Waiting: When a process is in running state then  process moves into the waiting state if it needs to wait for a resource, such as waiting for user input, or waiting for a file to become available.
Terminated or Exit: Once the process finishes its execution, or it is terminated by the operating system, it is moved to the terminated state where it waits to be removed from main memory.
I hope that this operating system study material will be beneficial for student to understand the basic concept of process.

Keywords: process concepts in operating system, difference between program and process, process states, process state diagram, process definition,process state transition diagram

Leave a Reply

Your email address will not be published. Required fields are marked *