slides14 - Memory Management Flashcards
1
Q
Memory units that can be directly addressed
A
- main memory (multiple clock cycles)
- registers (1 clock cycle)
2
Q
Address binding (3)
A
- When loading a program into memory -> need to resolved all address references so they point to locations occupied by that program
- Compile-time: know where program would reside in memory and does not change
- Load time: don’t know where program would reside at compile time; addressing needs to relative
- Execution time: want to change memory locations of code segment at runtime; need hardware support so can be loaded and unloaded several times during execution
3
Q
Logical vs Physical address spaces
A
LOGICAL ADDRESS
- aka virtual address
- generated by CPU
PHYSICAL ADDRESS
- address seen by memory
4
Q
Memory management unit (MMU)
A
Translates logical address to physical address
5
Q
Static loading
A
- Load whole program at the start
- Problems:
1. wait for whole program to load into memory
2. waste memory by loading unused portions of program for a given run
6
Q
Dynamic loading
A
- Defer loading and only load when needed
- Disadvantage:
- loading can happen at runtime and runtimes can be affected by loading
- loaded segments should be cached so future references can be quick and only first reference suffers
7
Q
Contiguous memory allocation
A
- Allocations for each process must be in a single contiguous block
- As processes are created, we allocate chunks of memory for each process and deallocate once completed
- Creates holes in memory -> external fragmentation
8
Q
Methods to allocate contiguous memory
A
- First fit: allocate the hole that is big enough from start location and stop there (50% of N blocks will be lost to fragmentation).
- Best fit: allocate smallest hole that is big enough. Search entire list of free holes.
- Worst fit: allocate largest hole. Search entire list. Produces largest leftover hole.
- Next fit: variation of first fit but starts next search where previous one left off.