Address Space and Process Control Block(PCB)
Source: Dev.to
Address Space
Every process running on a system has memory allocated for its address space, which consists of the following regions:

| Region | Description |
|---|---|
| Stack | Contains function calls, return addresses, local variables, etc. |
| Gap | Empty space reserved for the dynamic memory (heap) to grow. |
| Heap | Used for dynamic memory allocation (malloc(), calloc(), …). |
| Data | Holds constant, global, and static variables. |
| Text | The program code / instructions (usually read‑only). |
- Each process has its own separate address space; processes cannot directly access each other’s memory.
- The operating system manages these regions and maps the virtual address space to physical memory.
- Errors such as illegal memory accesses result in a segmentation fault.
Process Control Block (PCB)
A Process Control Block is a data structure used by the OS to manage a process—essentially an ID card for the process. It resides in kernel space within the process table.
Key components of a PCB:
- Process ID (PID) – Unique identifier for the process.
- Process State – One of: New, Ready, Running, Waiting, Terminated.
- CPU Registers – Program Counter (PC) and other registers needed for execution.
- Scheduling Information – Priority, queue position, and other scheduling data.
- Memory Information – Pointers to the process’s address space and memory limits.
- I/O Status Information – List of open files, devices, and other I/O resources.
The OS uses the PCB to:
- Manage processes and their life cycles.
- Perform context switches between processes.
- Track execution state and resource usage.