HW8 Solutions 1. 1a. 7 pages, computed as 3 data pages plus 4 pages of metadata. 1b. 2^9 + 6 (=518): computed as 5 pages of metadata (one L1 page table, one L2 page table, one L3 page table, one L4 page table with 2^9 entries full, and one more L4 page table) + 2^9 + 1 data pages. 1c. 2^18 + 2^9 + 6: Each L3 page table points indirectly to 2^18 last-level page entries (each L3 page table has 2^9 entries, each of which points to an L4 page table with 2^9 entries). Thus, the question requires two L3 page tables. The first L3 page table points to 2^9 L4 page tables; the second points to one L4 page table, for a total of 2^9 + 1 L4 page tables. Thus, the total is: 1+1+2+2^9+1 for the page structures (aka metadata) plus 2^18 + 1 for the pages themselves. 2. First read the first int of the first page, then the first int of the second page (to create a new TLB entry), and so on through all six pages (this is the inner loop below, with i=0). Then read the second int of the first page, the second int of the second page, and so on through all six pages. This access pattern is reflected in the code below: uint64_t tlb_unfriendly() { int *a = page_alloc(6 * PAGE_SIZE); populate_array(a); // sets the integers in the array uint64_t sum = 0; /* YOUR CODE HERE: compute sum in the most TLB-unfriendly way possible */ for (int i = 0; i < PAGESIZE/sizeof(int); i++) for (int j = 0; j < 6; j++) sum += a[j*PAGESIZE/sizeof(int) + i]; return sum; } 3.1 200 words/min x 1 min/60 seconds x 7 letters/word x 1 interrupt/character = 23 interrupts/second. 3.2 It should use interrupts. Your interrupts cost the computer 23 microseconds out of every second; this is a trivial fraction (23 parts in one million). If the computer used polling, you (the human) would notice the lag and get annoyed.