Introduction to Process - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

Introduction to Process

Share This

By definition, a process is a program in execution.

Let us try to understand what a process is? We are assuming that you are familiar with the C programming language. So, your first program is Test.c, which is nothing but a program. After compilation on the Windows environment, a new file Test.exe is generated. Similarly, in Unix/Linux environment, a.out file is generated. Both Test.exe and a.out are nothing but a program again.


If you open Task Manager on a Windows environment or check processes on Unix/Linux environment using ps command, there is no such entry by this file name. Hence, you do understand that these are not processes. If you run the program, and check the process list before terminating the program, you will get an entry in the process list. Thus, when this program is in execution, it's known as a process.



Process in Detail


A process is not just a code, a process is an active entity as opposed to a program which is considered to be a passive entity. Attributes held by the process include hardware state, memory, CPU, etc.


Each process theoretically has a separate virtual CPU. Of course, in reality, the actual CPU switches back and forth between different processes, but it is much simpler to comprehend the system if you imagine a group of processes that are operating (pseudo) simultaneously rather than trying to keep track of how the CPU changes programs. Multiprogramming refers to this quick movement back and forth between tasks.


A process is loaded into the main memory and uses CPU cycles to operate on the system.


The memory, which is allocated to a process, is divided into four sections such as:


  • Text section: The compiled program code is read into the text section from non-volatile storage when the application is launched.
  • Prior to calling the main function, global and static variables are allocated and initialized in the data section.
  • Heap Memory: It is used for the dynamic memory allocation
  • Stack Memory Local variables are stored in Stack Memory. When variables are specified, stack space is reserved for local variables.


Different Process States

When a program is running in an operating system, a process is established. The several states this procedure goes through are listed below.

new a process is created.
ready the process is waiting to get access to a processor to execute.
running instructions of the process are being executed in processor.
waiting a process is waiting for some event to occur (such as I/O operations or reception of a signal message).
terminated 

a process has finished execution, and the resources are released.


Process Control Block (PCB)


To implement the process model, the operating system maintains a table (an array of structures) called the process table, with one entry per process. Some authors refer to these entries as process control blocks. A PCB is linked to a method. A data structure called a PCB houses all of the process data.

A PCB which contains the following information:

  • Process State: state of the process that can be new, running, waiting, etc.
  • Process ID and parent process ID:Process
  • CPU registers and Program Counter: The Program Counter holds the address of the next instruction to be executed for that process.
  • CPU Scheduling information Such as priority information and pointers to scheduling queues.
  • Memory Management information: For example, page tables or segment tables.
  • Accounting information The User and kernel CPU time consumed, account numbers, limits, etc.
  • I/O Status information: Devices allocated, open file tables, etc.


Happy Exploring!

No comments:

Post a Comment