06 - Process attributes
Class: CSCE-313
Notes:
Outline:
- Process attributes
- Process context switching as a way of virtualizing the CPU
- Process states and some early thoughts on process schedulers
The story so far
...
Notes:
- We write a program in some high-level language
- The compiler turns it into an executable stored into a specially formatted file (linking format)
- In that file there are sections that define where the code and data segment is
- It also takes care of libraries, becoming part of the executable
- Every time you want some service from the OS you go from privilege 3 to 0 and execute code in the kernel
- There is a dispatching mechanism that allows you to redirect to entry points
Program execution flow
- Load code and data segments from executable file into memory
- Create stack and heap
- Transfer control to program's entry point
- Provide services to it (network, file connections IO, etc.)
Notes:
- Heap is created on-demand, the OS gives you 1 or two pages extra into your virtual address space
- You jump into the entry point of your program (which is not your main function)
- This will build a stack frame for your main function
- As you do system calls you get more services from your OS
Program execution flow
...
Notes:
- Context switching is saving all of this info into some block of memory and restoring the state from another process
- The moment you assign the instruction pointer, it will be that other processes instruction
- Is really nothing more than switching memory blocks