Coupon Accepted Successfully!


Process Management

A program in execution is a process. A process is executed sequentially, one instruction at a time. A program is a passive entity. For example, a file on the disk. A process on the other hand is an active entity. In addition to program code, it includes the values of the program counter, the contents of the CPU registers, the global variables in the data section and the contents of the stack that is used for subroutine calls. A program becomes a process when the executable file of a program is loaded in memory. There can a possibility be in bigger programs that more than one process is needed to completely run the program, but there are nevertheless considered two separate execution sequences.

Process after being loaded in memory The above diagram shows the process memory state when it is in execution. The stack region is used to store temporary data being used by the process. The Heap is the memory region that is dynamically i.e. on run-time allocated to the process. It consumes the free space in memory(Random access memory). Data region holds the computed results and values, and the global variables being used by the process. The text region holds the code or the executable instructions for the process.

Process state


A process being an active entity changes state as execution proceeds. A process can be any one of the following states:

  • New: Process being created.
  • Running: Instructions being executed.
  • Waiting: Process waiting for an event to occur.
  • Ready: Process waiting for CPU.
  • Terminated: Process has finished execution.
  • A state diagram is used to diagrammatically represent the states and also the events that trigger the change of state of a process in execution.
  • The names of these states are arbitrary, but what signify is common across all operating systems. At a particular instant, a process can be in only one of the states shown above. Many processes may be waiting or ready for running.

Process Control Block

Every process has a number and a process control block (PCB) represents a process in an operating system. The PCB contains information that makes the process an active entity.

The PCB consists of the number of the process, its state, value of the program counter, contents of the CPU registers and much more as shown below. The PCB serves as a repository of information about a process and varies from process to process.
  • Information associated with each process:

    1. Process state – The state, may be any of the 5 states shown in process state diagram such as New, ready, running, waiting and terminated.

    2. Program counter – This indicates the address of the next instruction to be executed for this process.

    3. CPU registers - the registers highly vary based on number and type and also depending on the computer architecture. They include accumulators, index registers, stack pointers and general purpose registers. Along with the program counter, this state information must be saved when an interrupts occurs to allow the process to be continued correctly after it recovers from the interrupt.

    4. CPU scheduling information – it includes information such as process priority, pointers to scheduling queues and other scheduling parameters.

    5. Memory-management information – this information contains value of base register and limit register, page tables, segment tables. These tables are used for referring to the right locations of memory to be used by the process.

    6. Accounting information – this includes amount od CPU and real time used, time limits, account numbers etc.

    7. I/O status information – This includes list of I/O devices allocated to the process, list of open files, etc.

Test Your Skills Now!
Take a Quiz now
Reviewer Name