1

I'm trying to implement On Demand paging with NRU (not recently used) algorithm.

It picks a page table entry based on two factors:

  1. If it has been referenced recently.
  2. If it has been modified at all.

The former can probably be set in the walkpgdir function which is what xv6 source code uses to get the page table entry for a Virtual Address.

But I'm not sure how to identify if and when a Page table entry has been modified.

enter image description here

I know that xv6 use x86 as a base and that has support for a PTE_D/dirty bit(as in the pic) which identifies if a page table entries has been modified or not. But that is not mentioned at all in the xv6 source.

Arturo
  • 191
  • 1
  • 1
  • 8
  • 1
    `#define PTE_FLAGS(pte) ((uint)(pte) & 0xFFF)` looks like it grabs those flags from the low part of a PTE. I'd have guessed there'd be a macro for the dirty-bit mask like `#define PTE_D (1<<6)` in that header, but presumably it's just hard-coded in code that uses it. – Peter Cordes Feb 08 '22 at 18:34

0 Answers0