What do base and limit registers do?
Base tells where your memory starts; limit tells how far you’re allowed to go.
What is the base register?
It holds the starting physical address of the memory region assigned to a process.
What is the limit register?
It holds the size (or upper bound) of the memory region the process may access.
How does address protection work with base/limit?
Every memory access is checked to see if it’s within the allowed range
What happens if a process accesses memory outside its valid range?
A protection fault/ trap occurs and the OS treats it as a fatal addressing error.
Why are base and limit registers considered privileged?
Only the OS kernel can change them to prevent processes from expanding their own access rights.
What is address binding?
deciding how a program’s addresses get matched to physical memory
What are the three main binding stages?
Compile-time binding, load-time binding, and execution-time binding.
What is compile-time binding?
The compiler generates absolute addresses because the load location is known at compile time.
Pro of compile-time binding?
Simple and fast at run time because no relocation is needed.
Con of compile-time binding?
Inflexible—if the load location changes, the program must be recompiled.
What is load-time binding?
The compiler generates relocatable code; Addresses are decided when the program is loaded into memory.
Pro of load-time binding?
More flexible than compile-time—no recompilation needed for different load locations.
Con of load-time binding?
If the process must move after loading, it typically must be reloaded.
What is execution-time binding?
Addresses are determined at run time, allowing a process to be relocated while executing.
Pro of execution-time binding?
Most flexible—supports swapping and moving to any available memory location.
Con of execution-time binding?
Requires hardware support for dynamic address translation.
What is a logical (virtual) address?
The address generated by the CPU from a program’s perspective.
What is a physical address?
The real address in RAM used by the memory hardware.
Why map logical to physical addresses?
To give each process a private, consistent address space while allowing the OS to place processes safely in physical memory.
What is the MMU (Memory Management Unit) used for?
Hardware that maps what the program thinks an address is to where it actually lives in RAM.
Static linking vs dynamic linking?
Static linking copies library code into the executable (bigger, multiple copies). Dynamic linking uses a small stub and links the library at run time (saves memory/disk).