3 major aspects of a process
How is a process made?
An application is stored on disk. When it gets launched, its binary gets executed and placed into main memory (in ready state) and becomes a “process” - an active entity
A process can be viewed as an “execution state” of an active application
What are the parts of a process?
All parts are uniquely identified by its address space or stack. Parts of the stack are text = static code, data = global vars set at initialization, heap, and stack (which dynamically changes via LIFO during execution)
What are page tables used for?
What data structure(s) does the O/S use to know what a process is doing at any given time?
Process Control Block
There are several bits of info (in PCB) to keep track. A couple of important items are Program Counter (and CPU registers), Stack Pointer, list of open files, page table, execution time of process, process priority, max memory usage and more.
Stack pointer is maintained in DRAM memory. Stack pointer points to top of process stack.
What does CPU use to keep track of where a process is during execution
+ Program Counter
Program counter is maintained on CPU. There are also other registers on CPU that keep track of addresses for status information, argument values. All these are part of the state of a process.
The program counter is updated on PCB only for a context change.
What is a Context Switch?
What are the costs of a Context Switch?
When O/S changes from scheduling a process to another process. All state must be saved to the PCB for the first process, then all state for new process from its PCB is initialized to CPU registers.
Costs of context switch are:
- direct costs - the number of cycles to load and store all values of PCB to and from memory
- indirect costs - the changing of data on the different levels on CPU cache
What is hot and cold cache?
Hot cache - cache hits - is correctly accessing data it is is seeking in the cache
Cold cache - cache misses - when cache is empty or irrelevant data is in the cache
What are the 3 different cache misses?