memory abstraction
Concept
RAM
- array of bytes with unique physical addresses
- contiguous region: interval of consecutive addresses
Data
- transient - valid for limited time
- persistent - valid for the duration of the program
- both types can grow or shrink during execution
Role of the OS
- allocate memory space to a new process
- manage memory space for process
- protect memory space of processes from each other
- manage memory for internal use within the process
Physical addressing
- processes load and store from physical addresses
- direct addressing
- hard to run multiple processes, load and stores may clash
Relative addressing
Address relocation
- when loading the process into memory
- add an offset to all memory references
- slow -> need to calculate everything
- hard to distinguish memory refernce from other instructions
Base + Limit registers
- base register -> points to the start of the space allocated to the process
- limit register -> size of the space allocated to the process
- logical address:
- at compile time, memory references are compiles as an offset from the base register
- each process has a self-containted logical memory space
- need to compute
physical = base + offsetand check offset < limit` for every access