Module 2: Virtual Memory and Caches
  Lecture 3: Virtual Memory and Caches
 


Addressing VM

  • There are primarily three ways to address VM
    • Paging, Segmentation, Segmented paging
    • We will focus on flat paging only
  • Paged VM
    • The entire VM is divided into small units called pages
    • Virtual pages are loaded into physical page frames as and when needed ( demand paging )
    • Thus the physical memory is also divided into equal sized page frames
    • The processor generates virtual addresses
    • But memory is physically addressed: need a VA to PA translation

VA to PA Translation

  • The VA generated by the processor is divided into two parts:
    • Page offset and Virtual page number (VPN)
    • Assume a 4 KB page: within a 32-bit VA, lower 12 bits will be page offset (offset within a page) and the remaining 20 bits are VPN (hence 1 M virtual pages total)
    • The page offset remains unchanged in the translation
    • Need to translate VPN to a physical page frame number (PPFN)
    • This translation is held in a page table resident in memory: so first we need to access this page table
    • How to get the address of the page table?