L13+Virtual+Memory - Topic 13 Memory Hierarchy - Virtual...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Memory Hierarchy - Virtual Memory Topic 13
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 2 Virtual Memory ± Use main memory as a “cache” for secondary (disk) storage ± Allow sharing of main memory in many programs ± Allow programs to go beyond the main memory size limit ± Managed jointly by CPU hardware and the operating system (OS) ± Programs share main memory ± Each gets a private virtual address space holding its frequently used code and data ± CPU and OS translate virtual addresses to physical addresses ± Protected from other programs by virtual memory ± Programs exceed main memory size ± Programs divided into self-contained, mutually exclusive small pieces – overlay – each overlay contains both code and data ± Overlays loaded and swapped to fit in smaller main memory ± Might not be a major issue with modern computers, still a concern for multithread processing, still a concern for embedded computers
Background image of page 2
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 3 VM Terminology ± Concepts in VM ± VM “block” is called a page ± VM “miss” is called a page fault Not yet in main memory Multiple programs share info Contiguous virtual addresses mapped to different physical locations in main memory – program relocation – provides freedom
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 4 Address Translation ± Fixed-size pages (e.g., 4K) Processor Address Mapping 12 bits – 4K page size Virtual address space is bigger than physically available memory – 4GB vs. 1GB
Background image of page 4
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 5 Page Tables ± Stores mapping of virtual and physical addresses – translator ± Each program has one page table ± Indexed by virtual page number ± Page table register in CPU points to start of page table of running program in physical memory ± If page is present in memory ± Page table stores the physical page address ± Plus other status bits (referenced, dirty, …) ± If page is not present in memory – page fault ± Page table can refer to location in swap space on disk
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 6 Translation Using a Page Table Page fault
Background image of page 6
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 7 Page Fault ± Page Fault ± Requested page in virtual address space not mapped to page in main memory ± On page fault, the page must be fetched from disk ± Takes millions of clock cycles ± Handled by OS code ± Try to minimize page fault rate ± Fully associative placement ± Smart replacement algorithms
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 5 — Large and Fast: Exploiting Memory Hierarchy — 8 Page Fault Penalty ± Most of the time for getting the first word in the page – access time – very long ± Should have large page size, so one access fetches more data ± Reduce page fault rate by fully associativity ± Handle page fault by software – more sophisticated with less expense ± Use write-back
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

L13+Virtual+Memory - Topic 13 Memory Hierarchy - Virtual...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online