Key Aspects of a Program and Process in an Operating System

 

Key Aspects of a Program and Process in an Operating System

1. Program vs Process

  • A program is a passive entity stored on disk (instructions and data).

  • A process is an active, running instance of a program.

  • The process is the primary abstraction used by the operating system to manage program execution.


2. Process State (What Defines a Running Program)

At any moment, a program executing as a process is described by its process state, which includes:

  • Memory contents in its address space (code, data, heap, stack)

  • CPU register values, such as:

    • Program Counter (PC)

    • Stack Pointer (SP)

  • I/O-related information, such as:

    • Open files

    • Read/write status

These elements together represent the complete execution context of the program.


3. Process API (How Programs Interact with the OS)

The operating system provides a process API that allows programs to:

  • Create new processes

  • Terminate (destroy) processes

  • Control execution (e.g., wait, suspend, resume)

  • Query process status

These system calls enable programs to request OS services related to execution and resource management.


4. Process States and Transitions

A process can exist in different states:

  • Running – currently executing on the CPU

  • Ready – prepared to run but waiting for CPU allocation

  • Blocked – waiting for an external event (such as I/O completion)

The OS moves processes between these states based on events like:

  • Scheduling and descheduling

  • Initiating or completing I/O operations


5. Process Management Data Structures

  • The OS maintains a process list to track all processes in the system.

  • Each process is represented by a Process Control Block (PCB).

  • The PCB stores all information needed to manage and resume the process.

Comments

Popular posts from this blog

Operating Systems OS PCCST403 Semester 4 BTech KTU CS 2024 Scheme

Introduction to Operating System -Virtualization, Concurrency, and Persistence

Operating Systems PCCST403 Scheme and Syllabus