Process lifecycle

The Process Control Block (PCB) is a data structure the operating system uses to manage and control processes. It contains all the information needed to handle a process, including its state, priority, and resource usage. The following are key components:

Process State: It defines the current state of the process (i.e. new, ready, running, waiting, terminated). It helps the OS determine what actions can be performed on the process.

Process ID (PID): A unique identifier is assigned to each process to distinguish between processes.

Program Counter: This counter stores the address of the next instruction to be executed, allowing the OS to resume execution from where the process left off.

CPU Registers: This part stores the values of CPU registers when the process is not running, helping the OS to restore the process's state when it resumes execution.

CPU Scheduling Information: Includes the process priority, pointers to scheduling queues, etc. This information determines when and how the process will be scheduled for execution.

Memory Management Information: Contains data about the process's memory usage, such as page tables and base/limit registers, helping the OS to manage the process's memory allocation.

Accounting Information: It holds the statistics about the process, such as CPU time used, real-time usage, etc. to help the OS to track resource usage for accounting and auditing purposes.


The Process lifecycle in an operating system is a critical concept that describes the various states a process goes through from creation to termination.

1. Start

This is the initial state of a process when it is created.

  • Process Creation: The operating system creates a new process using a system call such as fork() , which duplicates the parent process. This new process is then assigned a unique process identifier (PID).
  • Key Activities:
    • Initialization: The OS allocates memory for the process and initializes its control block, which contains information about the process state, priority, and resource usage.
    • Loading: The executable code is loaded into memory, and the process is prepared for execution.

2. Ready

In this state, the process is ready to run but is waiting for CPU allocation.

  • Process Scheduler: The operating system uses a scheduler to manage which processes get CPU time. The ready state can contain multiple processes waiting for execution.
  • Key Activities:
    • Context Switching: The OS may switch between processes in the ready state based on scheduling algorithms (e.g., First-Come-First-Served, Round Robin).
    • Resource Allocation: The process is prepared to use system resources, such as memory and I/O devices, as soon as it gets CPU time.

3. Running

The process is actively executing instructions on the CPU.

  • Execution: The CPU fetches and executes the process's instructions. The process can modify its state, access memory, and perform I/O operations.
  • Key Activities:
    • Instruction Execution: The CPU executes the process's instructions, which may include arithmetic operations, data manipulation, and system calls.
    • State Change: During execution, the process may need to wait for resources (e.g., I/O operations), which transitions it to the waiting state.

4. Waiting

Processes often wait for resources that are currently unavailable, such as user input or data from a disk.

Key Activities:

  • Event Monitoring: The OS monitors the waiting processes and will transition them back to the ready state once the required resources become available.
  • Resource Management: The OS manages resource allocation to ensure that processes can access the necessary resources without deadlock.

5. Finished (or Exit)

The process reaches this state when it has completed its execution or has been terminated.

  • Termination: The process may finish successfully or be terminated due to errors, user intervention, or system constraints.
  • Key Activities:
    • Resource Deallocation: The OS reclaims all resources allocated to the process, including memory and file handles.
    • Exit Status: The process returns an exit status to the parent process, indicating whether it was completed successfully or encountered errors.
    • Removal from Process Table: The process is removed from the OS's process table, which tracks all active processes.