Operating Systems | Concept of Process


Hard disk drive of the system in called primary memory and secondary memory is Random Access Memory(RAM). Either a program written in High Level Language(HLL) or a executable code generated by the sequence of works done by pre-processor, compiler and assembler, resides in secondary memory of the system.

To start an execution, operating system allocates some space in the main memory, for the program to be executed and loads the program in the secondary memory to the allocated space. The piece of work which is loaded by the operating system to the main memory in order to execute program is called process

Every program loaded by operating system will create a focus boundary(or process body), a partitioned memory area where all memory requirements for the execution of program is satisfied.

  • Variable which will not change its value through out life time of process is called static variable and variables which are globally accessible in a process known as global variable.
  • Heap area is reserved for dynamic allocation of memories
  • Stack area for the stacking of recursive function calls.
  • Since heap and stack have a dynamic behavior they are defined to grow in opposite direction as shown

After creating the focus boundary CPU will be executing the line available in the executable code and depending on the nature of execution line(dynamic allocation request refers to heap, recursive calls refers to stack, request to access static or global variable refers to respective areas) it may have to refer to the remaining areas of the process boundary. Referring to a memory location beyond the scope of process boundary will lead to segmentation fault.

Operating system maintains a linked list of information regrading all the processes. A node of this linked list includes data necessary to control and execute the process, such a node is called Process Control Block(PCB or context)

A Process Control Block have the following attributes:

Process IDHolds unique identification number given by OS for each process
Program CounterHolds information about the address of next instruction, that has to be executed
Process StateHolds the present state of the process(example: Ready, Runn, Block...)
PriorityHolds a number which represents the importance of the process, high priority means probability to get processed is high
General Purpose RegisterIt hold values of general purpose registers, so that change of register values will while switching between processes, can be avoided by reassigning values stored in this attribute.
List of FilesHold list of all files that are opened by the process in any mode(Reading mode, Writing mode, Read/Write mode)
List of Open DevicesHolds data about the open devices, which are in use at the that instant of process
ProtectionContains security information to avoid illegal data access

Comments