Process Management: Operating Systems

Ankur Kulhari

What is a process

A program in execution is called as a process. A process is an active entity, means it can be a cause of change in system’s state/data/elements.

when does a program becomes a process

A program is a file stored on secondary storage which contains, set of instruction written for some specific purpose. When this program is executed (say double clicked) it will be loaded into main memory (file or the instruction). To execute it, CPU looks for PC (program counter, which stores tells CPU the next instruction to be executed). So this program will be be allocated a PC value. A stack, heap to store static/local and dynamic/global variables, and an ID (PID or process ID) to disgustingly recognize it among all other processes, will also be assigned to it. After allocating these information/resources now it becomes a process.
So, a process can be realized as:

Process = program+resources

Process in main memory(RAM)

Following figure shows a process in main memory:

Process in memory

Fig. 2: Process in memory

A process needs support from operating systems for:

  • Creating and removing (destroying) process
  • Controlling the progress of processes
  • Acting on interrupts and arithmetic errors.
  • Resource allocation among processes
  • Inter process communication
Process creation using fork() system call

When a process invokes/calls fork() function, a new process is created which has the same address space.
As the address space is copied => PC (program counter) will also has the same value as old process has. That means the newly created process (also called as child process) will start executing from the instruction, parent process is currently executing => just after the fork().

process creation using fork

Fig. 3: process creation using fork- memory aspect

For C program to create new process using fork() click here
For more details about Process management and Inter process communication please refer following slide:

Comments 1

  1. Pingback: Introduction to Operating Systems - Study Korner

What do you think about the article?