Process Management

A process is an active program ? a program that is under execution. It contains the program code, program counter, process stack, registers, and other execution context information.

Process States

During its lifecycle, a process transitions through different states. These state changes are managed by the operating system scheduler and occur based on resource availability and system events.

Process State Diagram New Ready Running Waiting Terminated admit dispatch preempt I/O wait I/O complete exit

  • New ? The process has just been created and is being loaded into memory.

  • Ready ? The process is waiting to be assigned the processor by the short-term scheduler.

  • Running ? The process instructions are being executed by the processor.

  • Waiting ? The process is waiting for some event such as I/O completion to occur.

  • Terminated ? The process has completed its execution and is being removed from the system.

Process Control Block

A Process Control Block (PCB) is a data structure that contains all the information needed to manage a process. The operating system maintains a PCB for each process in the system.

Process Control Block Structure Process Identifier (PID) Process State Program Counter CPU Registers Memory Management Info I/O Status & File List

  • Process Identifier (PID) ? A unique number assigned to identify the process.

  • Process State ? Current state of the process (new, ready, running, waiting, terminated).

  • Program Counter ? Address of the next instruction to be executed.

  • CPU Registers ? Contents of processor registers including accumulators, index registers, and stack pointers.

  • Memory Management Information ? Base and limit registers, page tables, or segment tables.

  • I/O Status & File List ? Open files and allocated I/O devices.

Process Scheduling

The operating system uses multiple scheduling queues to manage processes efficiently. Processes move between these queues as their execution requirements change.

Long-Term Scheduler

The long-term scheduler (job scheduler) selects processes from the storage pool and loads them into memory for execution. It controls the degree of multiprogramming by maintaining an optimal mix of I/O-bound and CPU-bound processes to maximize system throughput.

Short-Term Scheduler

The short-term scheduler (CPU scheduler) selects one process from the ready queue and allocates the CPU to it. This scheduler executes very frequently ? often every few milliseconds ? to ensure responsive system performance.

Medium-Term Scheduler

The medium-term scheduler handles swapping by temporarily removing processes from main memory to secondary storage. It can later swap the process back into memory from where it left off, helping to reduce memory contention and improve the process mix.

Context Switching

Context switching is the mechanism of saving the state of a currently running process and loading the state of the next process to be executed. This involves storing the current process context in its PCB and loading the context of the new process from its PCB.

The dispatcher is the OS component responsible for performing context switching. While essential for multitasking, context switching introduces overhead since the CPU performs no useful work during the switch.

Conclusion

Process management is fundamental to operating system functionality, involving state transitions, control blocks for process information, and multiple schedulers working together. Context switching enables multitasking but introduces performance overhead that must be carefully managed.

Updated on: 2026-03-17T09:01:38+05:30

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements