Lecture 3: Processes and threads Flashcards
What is the execution sequence?
- Fetch instruction at PC and save it in IR (instruction register)
- Decode instruction in IR
- Execute (possibly using registers)
- Write results to registers or memory
- Update PC
- Repeat
What does this mean:
lw r1, 100
Load the word from 100 into register r1.
What does this mean:
add r3, r1, r2
add r1 + r2 and save it in r3
What does this mean:
sw r3, 100
store the word that’s in r3 into address 100
What is a context (of execution)?
- The value of the registers (PC, stack pointer, heap pointer, etc.) - from the CPU
- What’s written in the memory (code, data, stack, heap)
- Internal data in the OS relevant to the program (user, priority, etc.)
When does the context change?
Every time there’s a change in the value of a register or the memory.
What is a process?
A process is a dynamic instance of an application execution
(an abstraction of “an individual computer”).
Moving between contexts is the process.
Resident process
A process that is currently executing on a CPU
Non-resident processes
Process that is not currently running in the CPU. The context is stored in a special location in memory.
When does a program become a process?
when the executable file is loaded into the memory (by the loader which is a component of the OS)
Every time you run a program it creates a new ____.
Every time you run a program it creates a new process.
A program can create ____ processes.
A program can create multiple processes.
Address space
The set of accessible addresses in the memory by the process (Given by two parameters: base and bound)
Who verifies that a process is accessing memory only in [base, base+bound]?
The CPU
When a process specifics address x, what does it actually mean?
base + x
This means that the same pointer address in different processes point to different memory.
Kernel memory
The OS’s address space