News for hackers. Stuff that matters.
Re:Why databases use ordered indexes but programming uses ha... by cesarb on Tuesday December 10, 2019 @08:12AM (#21752093)
Yes, and each level of the tree has the physical address of the next level, so no TLB lookup is necessary (the top of the tree, in the TTBRn or equivalent registers, is also a physical address).
Re:Why databases use ordered indexes but programming uses ha... by ithkuil on Tuesday December 10, 2019 @08:17AM (#21752131)
oh yeah, I totally misread the comment: a page fetch is required, but that has nothing to do with the TLB indeed
Re:Why databases use ordered indexes but programming uses ha... by narnianal on Tuesday December 10, 2019 @10:12AM (#21753157)
what's the difference? "page fetch" is not really something that can be googled on the web.
Re:Why databases use ordered indexes but programming uses ha... by ithkuil on Tuesday December 10, 2019 @12:37PM (#21754637)
the TLB is just one element of the process that leads to resolve a virtual address into a physical one: it's a cache that hosts the most recently resolved addresses.

When the virtual address you're looking to resolve is not present in that cache (i.e. when you have TLB miss), the CPU falls back to walking the page table hierarchy. At each level of the tree, the CPU reads an physical address of the next level of the tree and performs a memory fetch of that page table entry (in my previous comment I erroneously said a "page fetch", but it's actually only performing a cache-line sized fetch) and repeatedly so until it reaches the leaves of the tree which contain the Page Table Entry that contains the physical address of the (4k) physical page associated with the virtual page address you wanted to resolve.