Process Control Block - aryanjoshi0823/5143-Operating-System GitHub Wiki
A Process Control Block (PCB), also known as a process descriptor, is a data structure used by an operating system to store all the information about a process.
- Created when a process is initialized or installed.
- Tracks process states (e.g., new, ready, running, waiting, terminated).
- Plays a critical role in context switching.
- Stored by the operating system kernel in a process table.
- Properties like the current working directory of a process are also stored in the PCB.
Role of PCB
The PCB is central to process management. It is accessed and modified by various utilities, especially those involved in:
- Process Scheduling
- Resource Management
Structure of a PCB
The PCB contains essential data for process management, falling into three main categories:
1. Process Identification
- Process ID (PID): Unique identifier for each process.
- Parent Process ID: Identifier for the process that created this process.
- User and Group IDs: User-level identifiers for ownership and permissions.
2. Process State
- Defines the status of a process when suspended, enabling the OS to resume it later.
- It includes:
- General-purpose CPU registers.
- CPU Process Status Word (PSW).
- Stack and frame pointers.
- Program Counter (PC): Address of the next instruction to execute.
3. Process Control Information
This category is crucial for process management and includes:
- Process Scheduling State: Includes the current state of the process (e.g., ready, suspended), priority, and elapsed time.
- Process Structuring Information: Information about the process's relationships with other processes (e.g., child process IDs, or processes related in a functional way).
- Structuring Information: Relationships to other processes (e.g., children processes).
- Interprocess Communication (IPC): Flags, signals, messages for interprocess communication.
- Privileges: Access permissions for system resources.
- Process State: Indicates whether the process is new, ready, running, waiting, or terminated.
- Program Counter (PC): Points to the next instruction to be executed.
- CPU Registers: Registers that store the process's state while running.
- CPU Scheduling Information: Details about the scheduling of the CPU for the process.
- Memory Management Information: Page tables, segment tables, memory limits.
- Accounting Information: CPU usage, time limits, execution identifiers.
- I/O Status Information: List of allocated I/O devices.