20-09-2013, 04:57 PM
Memory Management: Overlays and Virtual Memory
Memory Management.ppt (Size: 373.5 KB / Downloads: 79)
ARM Linker Supports Overlays
Overlay manager loads an overlay segment when it is not in RAM
Supports Static and Dynamic Overlays
Static overlays
One root segment
2 or more memory partitions (1 for the root partition which is always in RAM)
Within each partition, any number of overlay segments
Only 1 overlay segment can be in a partition at a given time
Application writer specifies what is in each partition and segment
Dynamic Overlay
Include re-location information with each overlay segment
Have overlay manager allocate memory for an overlay segment when it is first loaded
Load and unload overlay segments by explicit calls to overlay manager
Each overlay segment is given its own name linker links each as if it were in its own partition
Solution: Virtual Memory
What is virtual memory?
Technique that allows execution of a program that may not completely reside in memory (RAM)
Allows the computer to “fake”' a program into believing that its memory space is larger than physical RAM
Why is VM important?
Cheap no longer have to buy lots of RAM
Removes burden of memory resource management from the programmer
Other benefits ...
How Does VM Work ?
Two memory “spaces”
Virtual memory space what the program “sees”
Physical memory space what the program runs in (size of RAM)
On program startup
OS copies program into RAM
If there is not enough RAM, OS stops copying program and starts it running with only a portion of the program loaded in RAM
When the program touches a part of the program not in physical memory (RAM), OS catches the memory abort (called a page fault) and copies that part of the program from disk into RAM
In order to copy some of the program from disk to RAM, OS must evict parts of the program already in RAM
OS copies the evicted parts of the program back to disk
ARM MMU
Complex VM and protection mechanisms
Presents 4 GB address space (why?)
Memory granularity: 3 options supported
1MB sections
Large pages (64 KBytes) access control within a large page on 16 KBytes
Small pages (4 KBytes) access control within a large page on 1 Kbytes
Puts processor in Abort Mode when virtual address not mapped or permission check fails
Change pointer to page tables (called the translation table base, in ARM jargon) to change virtual address space
useful for context switching of processes
Summary of Lecture
How do programs run in memory?
What happens on “overflows”?
Memory Overlays
static overlays and dynamic overlays
Problems with overlays
Virtual Memory (VM)
What is VM?
How does VM work?
Virtual address to physical address mappings
Page faults
VM Schemes
page tables
virtual pages and physical page frames
page table entries
interactions with the rest of the system
two-level page tables