1. LPU MCA Semester 1
  2. CAP366
  3. Unit 3

CAP366 · Unit 3: Process management

Process control block

10 practice questions · in the MTE and ETE syllabus

Key points

  • PCB = kernel's record of a process
  • Holds state, PID, PC, registers, memory and I/O info
  • Created at process creation, freed after wait()
  • Does not hold the program's code

The PCB (task_struct in Linux) is the kernel's record of a process. It lives in kernel memory from creation until the parent collects the exit status.

Typical fields: process state, process ID and parent ID, program counter, CPU registers, scheduling information (priority, queue pointers), memory-management information (page tables, base/limit), accounting information and I/O status (open files, devices).

Field groupUsed for
State, PID, PPIDIdentification and scheduling decisions
PC and registersResuming exactly where it left off
Memory infoRestoring the address space
Accounting / I/OBilling, open files

Example: a table for 500 processes with 1.5 KB PCBs reserves 500 x 1.5 = 750 KB.

Exam pitfall: the PCB does not contain the program's source or data; it holds the information needed to manage and resume the process. After fork the child gets a new PID but a copy of most other fields.

Try two questions

Question 1 · Tier 3, Apply

A parent calls fork(). Which PCB field of the child must differ from the parent's copy?

  1. Scheduling priority
  2. Process identifier (PID)
  3. List of open files
  4. Saved program counter
Show the answer

B. Each process needs a unique PID, so the child's PID differs. Priority, open files and the program counter are initially copied.

Why not A: The child normally inherits the parent's priority.

Why not C: The child inherits copies of the parent's open file descriptors.

Why not D: Right after fork both processes resume at the same instruction.

Question 2 · Tier 4, Analyse

Why does the OS keep each PCB in kernel memory rather than in the process's own address space?

  1. The saved registers would be too large to fit on the user stack of any process
  2. The kernel cannot read the user address space while the process is not running
  3. Kernel memory is fast enough for the whole context switch to finish in one cycle
  4. A user process could otherwise alter its saved state, priority or page tables and break protection
Show the answer

D. If the PCB were user-writable, a program could change its priority or memory mappings. Keeping it in kernel memory protects the OS.

Why not A: The saved state is small, and size is not the reason.

Why not B: The kernel can access user memory whenever it needs to.

Why not C: A context switch takes many cycles regardless of where the PCB lives.