OPERATING SYSTEM BASICS

2. PROCESS MANAGEMENT

2.1. PROCESS LIFECYCLE

2.1.1 What is a Process?

A process is a program in execution. It is an active entity, unlike a program, which is a passive set of instructions stored on disk. A process requires resources such as CPU time, memory, files, and I/O devices to perform its task.


2.1.2 States of a Process

A process goes through several states during its execution. The major process states are:

  1. New:
    The process is being created.

  2. Ready:
    The process is waiting in the queue to be assigned to the CPU.

  3. Running:
    The process is currently being executed by the CPU.

  4. Waiting (Blocked):
    The process is waiting for some event (like input from a device) to occur.

  5. Terminated:
    The process has finished execution and is being removed from memory.


2.1.3 Process Control Block (PCB)

Each process has a Process Control Block (PCB) which stores important information such as:

  • Process ID

  • Process state

  • Program counter

  • CPU registers

  • Memory management information

  • I/O status

  • Accounting information

The OS uses the PCB to manage and track processes.