Search code examples
memorymemory-managementtlb

TLB vs Page Table


The page table associate each virtual page with its associated physical frame. The TLB does the same except it only contains a subset of the page table.

What is the purpose of the TLB if page table does the same thing and has more data?


Solution

  • Speed.

    The TLB is a cache that holds (likely) recently used pages. The principle of locality says that the pages referenced in the TLB are likely to be used again soon. This is the underlying idea for all caching. When these pages are needed again, it takes minimal time to find the address of the page in the TLB. The page table itself can be enormous, so walking it to find the address of the needed page can get very expensive.

    See https://en.wikipedia.org/wiki/Translation_lookaside_buffer