Memory Management Flashcards
Why is memory management relevant to to Operating System?
OS responsible for loading programs into memory, physical addresses are HW dependent.
What is the purpose of memory protection?
Processes share physical memory, need to restrict access to prevent errors and improper access.
What types of variables are there?
Locally declared (part of stored program), loaded into memory by OS
Dynamically allocated, Malloc - process asks for some memory.
What is a logical address?
Memory address generated by the CPU and is in the virtual address space.
what is a physical address?
Memory address generated by the Memory Management Unit (MMU)
Passed to memory hardware and is in the physical address space.
What is address binding?
Mapping symbolic address to physical addresses.
What are the attributes of compiled code?
Contains Physical memory addresses
Inflexible, have to re-compile to move process.
What happens at load time?
Compiler generates relative addresses (re-locatable code)
Process must occupy contiguous region of memory.
What do load time and compile time both result in?
Identical logical and physical memory addresses. (not used)
What is run-time binding?
Yields different logical and physical addresses.
Logical addresses dynamically mapped to physical addresses
What are the advantages of run-time binding?
It’s felxible, process can occupy non-contigous regions of physical memory and can be moved in memory during execution.
What are the disadvantages of run-time binding?
Runtime overheads means HW support required, MMU carries out the mapping.
What is static linking?
Linker combines object code of application modules with object code containing system library routines.
What are the disadvantages of static linking?
Wastes space as each program has a copy of system library
If a library routine is changed program must be re-linked.
What is dynamic linking?
Linker generates executable with stub (code specifying how to locate routine) for each library routine
Stub overwritten with address of routine on first execution. (subsequent execution incurs no overhead)