05-10-2012, 04:37 PM
Memory Management
Memory Management.ppt (Size: 587 KB / Downloads: 51)
Virtual Memory: Paging
A page is a cacheable unit of virtual memory
The OS controls the mapping between pages of VM and memory
Two Views of Memory
View from the hardware – shared physical memory
View from the software – what a process “sees”: private virtual address space
Memory management in the OS coordinates these two views
Consistency: all address space can look “basically the same”
Relocation: processes can be loaded at any physical address
Protection: a process cannot maliciously access memory belonging to another process
Sharing: may allow sharing of physical memory (must implement control)
Dynamic Storage-Allocation Problem
How to satisfy a request of size n from a list of free holes.
First-fit: Allocate the first hole that is big enough.
Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size. Produces the smallest leftover hole.
Worst-fit: Allocate the largest hole; must also search entier list. Produces the largest leftover hole.
First-fit and best-fit better than worst-fit in terms of speed and storage utilization.
Virtual Memory
Virtual memory is the OS abstraction that gives the programmer the illusion of an address space that may be larger than the physical address space
Virtual memory can be implemented using either paging or segmentation but paging is presently most common
Actually, a combination is usually used but the segmentation scheme is typically very simple (e.g., a fixed number of fixed-size segments)
Virtual memory is motivated by both
Convenience: the programmer does not have to deal with the fact that individual machines may have very different amount of physical memory
Fragmentation in multi-programming environments