Process In Operating Systems

Share this blog with others!

A process is essentially a running program. The execution of a process must proceed in a logical order.

There may be several processes in the system that demand the same resource at the same time. As a result, the operating system must handle all operations and resources in a convenient and efficient manner.

The operating system is in charge of Process Management, which also includes the allocation and de-allocation of resources to processes.

Process Deep Dive

When a program is put into memory and becomes a process, it is divided into four parts: stack, heap, text, and data.

Memory Layout of a program

Learn more about the memory layout of a program.

Process characteristics

The Operating System uses the process attributes to generate the process control block (PCB) for each of them. This is also known as the process context. The next sections discuss the attributes that are saved on the PCB:

  1. Process ID: When a process is created, a unique id is issued to it, which is used for the process’s unique identification throughout the system.
  2. Program Counter: A programme counter maintains the address of the process’s last instruction before it was interrupted. When the execution of this process is resumed, the CPU utilises this address.
  3. Process State: From process’s beginning until its termination, the Process passes through several phases, including new, ready, operating, and waiting. The PCB also records the process’s state, which allows the CPU to resume the operation from where it was paused.
  4. Priority: Each process has its own priority. Among the processes, the one with the highest priority receives the CPU first. This data is likewise saved on the process control block.
  5. General Purpose Registers: Each process has its own set of registers that are used to store data created during the process’s execution.
  6. List of open files: During execution, each process makes use of files that must be present in main memory. The OS also keeps a list of open files on the PCB.
  7. List of open devices: The operating system also keeps a list of all open devices that are used throughout the process’s execution.

Process Lifecycle

Source – javatpoint.com

From start to finish, the process goes through several stages:

  1. New: A new process is a programme that will be loaded into main memory by the operating system.
  2. Ready: Ready state processes are processes that are ready for execution and exist in main memory. Many processes may be present in the ready stage.
  3. Running:A process that is executing on the CPU is referred to as being in the running stage.
  4. Block or Waiting: The CPU can also preempt a process based on the scheduling algorithm in use, and the process can be moved from the running to the blocked or waiting state. A process also preempts when they require to perform I/O operations.
  5. Completion or Termination: When a process has completed its execution, it enters the termination state. The process’s context (Process Control Block) will likewise be removed, and the process will be terminated by the operating system.
  6. Suspended ready: A process in the ready state that is transferred to secondary memory from main memory due to a shortage of resources (mostly primary memory) is referred to as being in the suspend ready state.
  7. Suspended wait: Rather than removing the process from the ready queue, it is preferable to delete the blocked process that is waiting for resources in main memory and thus is in suspended waiting stage.

0 0 votes
Article Rating

Share this blog with others!
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Scroll to Top