We run the following code with an empty TLB. Calculate the TLB miss rate for data (ignore instruction fetches). Assume i and sum are stored in registers and cool is page-aligned.
#define LEAP 8 int cool[512];
... // Some code that assigns values into the array cool
... // Now flush the TLB.
Start counting TLB miss rate from here.
int sum;
for (int i = 0; i < 512; i += LEAP) {
sum += cool[i];
}
What is TLB miss rate?
Let assume that LRU page replacement policy is used with a TLB of 4 sets that uses 8-way set associativity.
Now, 4 sets with 8-way associativity is used. Thus there are total 4*8 number of values can be stored in the TLB. The given for loop runs from i=0 to i<512 with an increment of 8 (since LEAP is defined as 8) at each step.
Since the total capacity of the TLB is 32 (number of values can be stored), the TLB miss rate will be 1/32. For the first 32 elements in the TLB, there will be no miss. Fresh values will be mapped in the TLB. But after every 32 elements, a TLB miss will be there.
Thus, the TLB miss rate will be: 1/32.
Get Answers For Free
Most questions answered within 1 hours.