Content
- Introduction to Memory Management
- Managing Memory with Bitmaps & Lists
- Simple Memory Management & Fragmentation
Introduction to Memory Management
- Requirements
- Isolation
- Abstraction
- Sharing
- Goals
- Low memory overhead
- Low performance overhead
- Supports
- Compiler
- Source file to object file
- Generates relocatable
virtual memeory addresses
- Linker
- Links multiple object files to single program on disk
- Generates absolute
virtual memeory addresses
- OS
- Loads program into
physical memory
- Sets up
virtual memory H/W
- Loads program into
- H/W
- Translates
virtual memory
tophysical memory
- S/W too slow for address translation
- Translates
- Compiler
Managing Memory with Bitmaps & Lists
After
boot loader
loads OS code & data in low memory,OS
keeps track ofallocated
&free
memoryBitmap
- 1 bit per chunk of memory; in use or not
Larger chunk size, lower overhead BUT more internal fragmentation
|--OS code data--| bit map | chunk1 | chunk2 | ... | 01101...
Linked Lists
- A list of elements for each allocated or free region of memory
Allocated bit + starting address + length + pointer
| A | f | B | C | f | D | E | f | ... | | a | 0 | 5 | [] | --> | f | 5 | 3 | [] | --> ...
Searching
- First fit
- Best fit
- Quick fit
Under which conditions is each approach preferable?
Simple Memory Management & Fragmentation
- Internal fragmentation
- Program doesn't use entire region -> paddings
- External fragmentation
- A large region cannot be allocated even enough memory exists
- Compaction: move processes around, but expensive
- A large region cannot be allocated even enough memory exists