Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Process Data Structures

Lesson 21 of 32 in the free Design of Unix Operating System notes on Siksha Sarovar, written by Rohit Jangra.

Introduction

The UNIX kernel uses several data structures to manage processes. These structures store everything the kernel needs to know about each process — its state, memory, open files, scheduling information, and more.

1. Process Table (proc structure)

  • A global kernel table with one entry for every process in the system.
  • The process table is always resident in memory (never swapped).
  • Each entry contains information needed even when the process is NOT running.

Process Table Entry Fields:

FieldDescription
PIDProcess ID
PPIDParent Process ID
StateCurrent process state
UID / GIDUser and Group IDs
PriorityScheduling priority
SignalPending signals
Pointer to u-areaLink to the process's u-area
EventEvent the process is sleeping on (if sleeping)
CPU usageRecent CPU usage (for scheduling)
Timer fieldsAlarm timer, profiling timer
PointersLinks to region table, parent, child, sibling processes

2. U-Area (User Area / u structure)

  • A per-process data structure that stores information needed only when the process is currently running or swappable.
  • The u-area is part of the process's kernel stack space and can be swapped to disk along with the process.

U-Area Fields:

FieldDescription
Process table pointerBack-pointer to the process table entry
User IDsReal UID, Effective UID, Real GID, Effective GID
Signal handlersUser-defined signal handling functions
TerminalControl terminal (tty)
Error fieldError code from last system call
Return valueReturn value of last system call
I/O parametersCurrent I/O operation details (address, offset, count)
File descriptorsArray of open file descriptors (User FD table)
Current directoryInode of current working directory
Root directoryInode of root directory for the process
File size limitMaximum file size the process can create
Accounting infoCPU time used, start time

3. Per-Process Region Table

  • Maps a process's virtual address space to physical memory regions.
  • Each process has its own region table.
  • Each entry points to a region in the kernel's global region table.

Region Types:

RegionDescription
TextExecutable code (read-only, shareable)
DataInitialized and uninitialized global variables
StackProcess stack (grows dynamically)
Shared MemoryShared memory segments (IPC)

Relationship Between Structures

┌──────────────────┐     ┌──────────────────┐
│  Process Table   │     │   Region Table    │
│  Entry (proc)    │     │   (per-process)   │
│                  │     │                   │
│  PID, State,     │     │  Text Region ──────►┐
│  Priority,       │     │  Data Region ──────►├─► Physical
│  Signals,        │     │  Stack Region─────►│   Memory
│  Pointer ────────┼──►  │                   │   (Regions)
│  to u-area       │     └──────────────────┘
└──────────────────┘
         │
         ▼
┌──────────────────┐
│    U-Area        │
│                  │
│  FD Table,       │
│  Signal Handlers,│
│  Current Dir,    │
│  Accounting,     │
│  I/O Params      │
└──────────────────┘

Process Table vs U-Area

AspectProcess TableU-Area
ScopeGlobal (all processes)Per-process
In MemoryAlwaysOnly when process is in memory
SwappableNoYes (swapped with the process)
AccessedEven when process is NOT runningOnly when process IS running
Info StoredState, PID, scheduling, signalsFD table, signal handlers, I/O, accounting

Summary

  • The Process Table stores minimal, always-needed info and is always in memory.
  • The U-Area stores detailed, process-specific info and can be swapped.
  • The Per-Process Region Table maps virtual addresses to physical memory.
  • Together, these three structures give the kernel everything it needs to manage a process.