Date: August 31, 2024
Topic: Process Execution State
Recall
The Program Counter (PC), CPU register, Stack Pointer and Process Control Block (PCB) help to manage and control the execution of processes within the CPU
Notes
How does the OS know what a process does?
- Have to know when a process stops so it can be restarted at the same point
- Applications must be compiled before their source code can be executed
- This produces a binary to be produced
- Sequence of instructions not necessarily executed sequentially (may have jumps, loops or interrupts)
Components defining what a process does
Program Counter

PC pointing to instruction in assembly code
- Register in CPU containing address of next instruction to execute
- CPU needs to know the instruction sequence of where the process currently is
CPU Register
- Serves as small, fast storage locations within CPU holding data and instructions temporarily
- PC is a specific register within the CPU
Stack Pointer
- Process stack defines what the process is doing
- Top of the process stack defined by stack pointer
- Need to know top of the stack as it exhibits LIFO behavior (stack pointer maintains this information)
Process Control Block (PCB)
- To maintain all of the information for every single process, the OS maintains a PCB
- Information can be state, program counter, stack pointer, CPU register contents etc
The PCB is a data structure that helps the OS capture all information about a process being managed
Its contents are updated whenever the process state changes
Process Control Block (PCB)

Data structure that the OS maintains for every single process being managed
- OS’s job to collect all information about a process
- Store it into a PCB structure when the process is no longer running on CPU
- PCB is created when a process is initially created (PCB initialized at that time)
- Certain fields are updated whenever the process state changes
- If a process requires more memory, the OS will allocate more memory and establish new valid virtual to physical memory mappings
- This will be reflected in memory limits information and information regarding valid virtual address regions for the process
- Other fields change quite frequently
- During execution of the program, the program counter changes on every single instruction
- CPU has a dedicated register to track program counter for current executing process
- PC register is automatically updated by CPU on every new instruction
A PCB holds the state of a process, which is saved when a context switch occurs and a process becomes idle and is restored when the process runs again
<aside>
📌 SUMMARY: Several components like the program counter, CPU register, stack pointer and process control block help to define a process. The PCB has a variety of mechanisms such as storing all data of a process in a data structure and supporting context switching, allocating memory to processes as needed between the processor cache and memory
</aside>