Midterm 1 Flashcards
(45 cards)
1 GB =
2^30
1 MB =
2^20
1 KB =
2^10
giga-
10^9
Static rewriting
rewrites two processes’ addresses to be distinct
Static rewriting issues
- relocation at runtime is hard (have to constantly rewrite process memory and pointers are hard to keep track of and manage)
- security (no isolation, pointers can access any random location)
Dynamic relocation
- base:
virtual address + base = physical address
can just change the base to automatically shift processes to new locations
- bound:
mem access checked by bound (if out of bound –> interrupt)
can processes access base and bound registers?
NO!!!!
base and bounds implementation
new CPU unit called memory management unit (MMU)
MMU has two registers: base and bounds
dynamic relocation issues
programs aren’t contiguous (chunks of free space between allocated memory)
Segmentation
using multiple base and bounds
what is a segment?
a base and bound pair that can be efficiently resized
segmentation implementation
uses MMU with a segment table containing variable # of segments
segmentation issues
requires contiguous regions but also results in external fragmentation
external fragmentation
combined space is large enough but memory is fragmented –> not individual free mem segment is useful
internal fragmentation
the memory reserved for a process can’t be used by OS until the process terminates
external fragmentation solution! (the bad one)
defragmentation: move previously allocated regions to get contiguous free space
defragmentation issues
expensive! running process might be stopped and allocation takes too long
external fragmentation solution! (the good one)
paging!
Paging idea
fine-grained and regular (constant) division of memory (called pages)
frames
fixed sized blocks of physical memory
pages
fixed sized blocks of a process’ address space
frame size = ?
page size
pros of paging
- don’t need a large contiguous region
(process still sees the address space as contiguous) - any page can be mapped to any frame