Finding TLB size with a program?

255 Views Asked by At

I am currently working on an assignment, where my initial task is to programmatically find the TLB size. Straight away my intuition was to map a large file using mmap, and read every 4096th byte if it. After 100 such reads, I should have accessed 100 pages (4k each), and 64 of these pages should have reference in TLB, while other should cause a TLB miss.

Once I have read these 100 pages, I read these same pages again, now the last 64 pages that have reference in TLB should have access time less than first 36 pages, but results are not supporting my intuition. All these pages have approximately the same access time. I even tried 1000 pages, but even these 1000 pages have similar access time when accessed second time, considerably lesser than the first access time.

What am I missing? Is my intuition is right? Any suggestions, how can I tackle this problem of finding TLB size?

I am using Ubuntu on a machine that has TLB: 4K pages, 4-way, 64 entries.

Thanks and Cheers,

0

There are 0 best solutions below