State the goal of memory protection.
To protect memory access to prevent malicious or buggy user programs corrupting other programs.
What is a logical address space defined by?
Base: the smallest legal address. Limit: the size of the range.
State the problem of address binding.
When programs are brought into memory to create processes, where to put them in memory given the program will refer to memory locations.
Describe the 3 address binding schemes.
Compile time: if memory location is known at compile time, absolute code can be generated. Load time: otherwise, generate relocatable code. Execution time: if the process can be moved during execution, binding is delayed until run time.
State the differences between logical and physical address.
Logical address is generated by the CPU. Physical address is the address seen by the memory unit.
Compare logical and physical addresses in different address binding schemes.
Identical in compile-time and load-time binding. Differ in execution-time binding.
Define logical/physical address space.
The logical/physical address space is the set of all logical/physical addresses generated by a program.
Why is hardware support needed for address binding?
To perform mapping from logical to physical addresses at real time.
Define the memory management unit.
It is the piece of hardware that maps logical to physical addresses at run time.
Describe how the memory management unit works.
The base register is replaced with the relocation register. Add the value in the relocation register for every address generated by the user process when it is sent to memory.
What address binding scheme does the memory management use?
Execution-time binding.
State how using a memory management unit makes user programs simpler.
User programs only deal with logical addresses, never seeing physical addresses.
What is linking?
Linking combines different object code modules to create a program.
Describe static linking.
All libraries and program code are combined into the binary program image.
Describe dynamic linking.
Linking is postponed to execution time.
What is dynamic linking commonly used for?
Linking system and shared libraries.
Describe how dynamic loading works.
Calls are replaced with a stub. When called, the stub replaces itself with the address of the routine, and executes the routine.
State the advantages of dynamic loading.
Better memory usage as unused routines are never loaded. Useful when large amounts of code are needed infrequently.
State the requirement for a library to be dynamically loaded.
Requires it to be compiled with relocatable addresses.
Describe contiguous allocation.
Each process is put in one chunk of memory.
What is variable partitioning?
Contiguous memory allocation where partitions are created at runtime.
How is the main memory partitioned?
Low memory for kernel and interrupt vectors. High memory for user processes.
What do the relocation registers protect?
User processes from each other. OS code and data from being modified.
What is swapping?
When memory requested exceeds physical memory in machine, temporarily move processes from main memory to storage.