Homework 5
Homework 5
Instructions
● Complete the following questions to the best of your ability
● Answers should be clear, concise, and justified with work
● Check the schedule and assignment overview for due dates and times
Collaboration
● Professor/TAs
○ You may discuss any content with any professor or TA.
● Students
○ You may discuss high-level concepts, techniques, jargon, keywords, related
problems, or course content that is relevant to the material.
○ You may not discuss particular solutions to any of the questions.
○ If you have substantial conversations with any students, please note their name
and, if you feel it necessary, the extent of your collaboration.
● Outside Sources (Internet, books)
○ You may use external references for any course content.
○ You may use an external tool to verify your solutions where appropriate, but not
to generate solutions to any questions.
○ List any outside sources that you use. Formal citations are not necessary; links
are fine.
Question 1 (50 points)
Virtual memory uses a page table to track the mapping of virtual addresses to physical
addresses. This exercise shows how this table must be updated as addresses are accessed.
The following data constitutes a stream of virtual addresses as seen on a system. Assume 4KB
page size, a 4-entry fully associative TLB, and true LRU replacement. Assume initial LRU way is
the one with tag 11. If a page must be brought in from disk, assume the page number is current
largest page number plus 1.
Address stream(in decimal): 573, 13920, 6323, 34587, 32776, 20800
1 11
0 Disk
1 4
0 Disk
0 Disk
1 3
1 4
(a) Given the address stream shown, and the initial TLB and page table states provided
above, show the final state of the system. Also list for each reference if it is a hit in the
TLB, a hit in the page table or a page fault.
(b) Repeat (a), but this time use 8KB pages instead of 4KB pages. What would be some
of the advantages of having a larger page size? What are some of the disadvantages?
(c) Show the final contents of the TLB if it is 2-way set associative. Also show the
contents of the TLB if it is direct mapped. Discuss the importance of having a TLB to
high performance. How would virtual memory accesses be handled if there were no
TLB? You can assume your initial LRU way.
32 bits 4 KB 4 bytes
(a) Given the parameters shown above, calculate the total page table size for a system
running 5 applications that utilize half of the memory available.
(b) Given the parameters shown above, calculate the total page table size for a system
running 5 applications that utilize half of the memory available, given a two-level page
table approach. Assume each entry of the main page table is 6 bytes. Calculate the
minimum and maximum amount of memory required.
(c) A cache designer wants to increase the size of a 4KB virtually indexed, physically
tagged cache. Given the page size shown above, is it possible to make a 16KB
direct-mapped cache, assuming 2 words per block? How would the designer increase
the data size of the cache?
Question 3 (15 points)
For each question, circle the best answer. If none of the selections are appropriate, then
choose “e. None of the above”.
2. What three operations (in the correct order) are required to read data from the hard
disk?
a. jal, sw, jr
b. Wait for rotation, seek, read data as it spins under
c. Interrupt, seek, read data as it spins under
d. Seek, wait for rotation, read data as it spins under
e. None of the above
Question 4 (5 points)
Briefly explain the differences between Exceptions and Interrupts using one or two
sentences at most.