<aside>
<img src="/icons/map-pin_gray.svg" alt="/icons/map-pin_gray.svg" width="40px" /> The next few upcoming lectures will be reminiscent of the topics we have previously covered in COE628 - Notes — going over topics such as process, threads, synchronization, and virtualization.
</aside>
Process
A process represents the execution instance of a program. It includes the program's code, data, and system resources necessary for its execution. The OS kernel allocates various resources to a process to facilitate its execution. These resources include:
- Processor (CPU): The central processing unit that performs computations.
- Registers: Small, fast storage locations within the CPU for quick access to data.
- Program Counter (PC): Keeps track of the memory address of the next instruction to be executed.
- Stack: Used for function calls, storing local variables, and managing program flow.
- Cache: Small, high-speed memory that stores frequently accessed data.
- Translation Lookaside Buffer (TLB): A cache that stores translations from virtual memory addresses to physical addresses — recall from COE758.
Processes require memory to store their code, data, and runtime variables. Memory is typically divided into various segments, such as text, data, heap, and stack.

Figure 3.1 Process memory layout.
The OS kernel manages the states and contexts of each process:
- States: Ready (waiting to execute), Execution (currently running), Blocked (waiting for an event), and Synchronization (coordinating with other processes).
- Context: Data in main memory, the content of registers, the PC value, and other information needed to restore the process's state.
When a process is loaded onto the CPU for execution, the OS kernel performs operations like:
- Context Switch: Switching from the execution of one process to another, preserving and restoring the context of each process.
- Memory Swap: Moving processes in and out of main memory to accommodate the limited physical memory available.
The OS kernel plays a central role in managing these resources and ensuring the smooth execution of multiple processes.