Chapter 18 Paging Intro - ZipingL/OperatingSystemsNotes GitHub Wiki

Chapter 18: Paging Intro

Page Table

A Page Table Entry has the following information

  • Page Frame Number
  • Valid Bit
    • e.g. did the process allocate this memory?
  • Protection Bits
    • Can we read from, write to, or execute from?
  • Present Bit
    • Is another process using this Frame? If so we will have to do a swap.
  • Dirty Bit
    • Has the page been modified?
  • Reference Bit/ Access Bit
    • Has the page been accessed since being put in memory (a frame)? A metric for popularity
    • Helps determine which frames to keep and which to swap.

Usually, the first page in a memory is reserved for OS, just as a side note.

Address Translation

Both the Virtual and Physical Address use the same offset. However, we replace the virtual page number bits from the VA with the page frame number bits, retrieved from the page table, instead.

In this example, say we have virtual address, we get the VPN to index the Page Table, finding out that the entry at index VPN gives a VFN of 111 bits:

    Composition [ Number for page or frame | offset]
    VA: [0 1 | 0 1 0 1]
    PA: [1 1 1 | 0 1 0 1]

Issues with Paging

A page table must reside in Memory. If we store in disk it would make the OS incredibly slow. For example, if a page table can have 1024 entries, and each entry uses 4 Bytes, the page table would be a size of 4 MB. However, if we have 1000 Processes, that 4 GB of memory being used up just for page tables!

Why not just store 1 Page table in memory at a time, and swap it out? That's too slow, but with multi level paging, we can do this! See Chapter 20.