Process

  1. A process in an operating system (OS) is a program in execution. It’s a dynamic entity that represents a running instance of a program.
  2. Each process has its own memory space, set of registers, and execution context.
  3. an instance of a program in execution, encompassing the program code, current activity, and the resources it uses, including memory and I/O devices.
  4. It is fundamental for multitasking in an operating system.

Key characteristics

  • Program Counter: Points to the next instruction to be executed.  
  • Registers: Stores data used by the process during execution.  
  • Stack: Used for function calls and local variables.  
  • Heap: Used for dynamic memory allocation.  
  • Open Files: A list of files that the process has open.
  • Process ID (PID): A unique identifier for the process.  
  • State: The current state of the process (e.g., running, waiting, ready).  

Detailed Explanation of Process States with Diagrams

1. New

  • Description: The initial state when a process is being created. The OS is preparing to allocate resources.

2. Ready

  • Description: The process is in the ready queue, waiting for CPU time to execute. It is fully loaded in memory.

3. Running

  • Description: The process is actively executing on the CPU. It performs computations and accesses system resources.

4. Waiting

  • Description: The process is waiting for an event to occur (e.g., I/O operation). It cannot continue until the event is resolved.

5. Terminated

  • Description: The process has completed execution or has been terminated. Resources are released back to the system.
  • Diagram:

State Transition Diagram