/* * tlbfaulter.c * * This program creates an array larger than the TLB footprint, * but hopefully smaller than memory. * It first touches each page of the array once, which should cause * each page to be loaded into memory. * Then it touches the pages sequentially in a tight loop - the * goal is to force the TLB to be filled quickly, so that TLB * replacements will be necessary. * * If this generates "out of memory" errors, you will need * to increase the memory size of the machine (in sys161.conf) * to run this test. */ #include #include /* * set these to match the page size of the * machine and the number of entries in the TLB */ #define PageSize 4096 #define TLBSize 64 /* an array a bit larger than the size of the TLB footprint */ #define ArraySize ((TLBSize+5)*PageSize) char tlbtest[ArraySize]; int main() { int i,j; printf("Starting the tlbfaulter program\n"); /* load up the array */ for (i=0; i