Presentation is loading. Please wait.

Presentation is loading. Please wait.

4.3 Virtual Memory.

Similar presentations


Presentation on theme: "4.3 Virtual Memory."— Presentation transcript:

1 4.3 Virtual Memory

2 Virtual memory Want to run programs (code+stack+data) larger than available memory. Overlays programmer divides program into pieces OS move pieces in and out from disk Virtual memory – OS automates overlays Virtual addresses vs. physical addresses

3 CPU MMU translates virtual addresses to physical addresses

4 Memory unit = page

5 Mapping virtual to physical addresses
Done in hardware for speed. Virtual address = page number and offset within page Each process has its own page table. Can be large Physical address = pageTable[pageNumber] + offset Must be fast Page fault occurs when a page is not in memory and is references.

6 Ex. 32 bit virtual address space
Given 32 bit virtual address space. Given 212=4096 byte pages. How many pages? 1 million!

7 Ex. Page table Page table size = 24 Page size = 212

8 Multilevel page tables

9 Example page table entry
Caching disabled bit For memory mapped I/O (use device, not cache) Referenced = used bit Modified = “dirty” bit Protection = R W X flags Present = in memory flag

10 TLBs – translation lookaside buffers
a.k.a. associative memory Lookup/search occurs in parallel 8 to 64 entries “cache” of frequently used page table entries

11 Inverted page tables Using virtual to physical page tables: Solution:
Over 1 million entries for 4K pages on a 32 bit system. Over 30 million gigabytes on a 64 bit system Solution: Use one entry per physical page (rather then one entry per virtual page) Search for virtual to physical translation becomes hard (slow) Use TLB and hash table

12 Page table vs. inverted page table


Download ppt "4.3 Virtual Memory."

Similar presentations


Ads by Google