Exercise
Improve your understanding and skills by attempting this exercise of measuring the size and the cost of accessing a TLB.
We'll cover the following
In this exercise, you are to measure the size and cost of accessing a TLB. The idea is based on
The basic idea is to access some number of pages within a large data structure (e.g., an array) and to time those accesses. For example, let’s say the TLB size of a machine happens to be 4 (which would be very small, but useful for the purposes of this discussion). If you write a program that touches 4 or fewer pages, each access should be a TLB hit, and thus relatively fast. However, once you touch 5 pages or more, repeatedly in a loop, each access will suddenly jump in cost, to that of a TLB miss.
The basic code to loop through an array once should look like this:
Get hands-on with 1400+ tech skills courses.