Northwestern University
EECS 213
EECS 213 Introduction to Computer Systems Dinda, Spring 2017
Page 1 of 3
Homework 4 Solutions
Virtual Memory and I/O
Grade out of 100 points
1. Suppose we have a machine with a 2^48 (48 bit) virtual address space, a maximum of 2^32 bytes of
physical memory, and a page size of 2^20 bytes. Assume a single-level page table to be
...[Show More]
EECS 213 Introduction to Computer Systems Dinda, Spring 2017
Page 1 of 3
Homework 4 Solutions
Virtual Memory and I/O
Grade out of 100 points
1. Suppose we have a machine with a 2^48 (48 bit) virtual address space, a maximum of 2^32 bytes of
physical memory, and a page size of 2^20 bytes. Assume a single-level page table to begin.
a. Draw a virtual address, splitting it into the virtual page number and the virtual page offset.
Note how many bits are used for each.
virtual address is 48 bits, top 28 bits are the virtual page number. bottom 20 bits are the virtual page offset.
b. Draw a plausible page table entry, showing the length in bits of each of the fields. How many
of your entries fit on a page?
with 32 bits of physical address space, 20 bits taken by VPO, a physical page number is only 32-20=12
bits. The PTE needs to have the physical page number (PPN), a valid bit, and a dirty bit. There are other
perhaps other bits as well. My PTE is 16 bits long (2 bytes). And there are 2^19 PTEs that can fit in a
page. Other answers are possible, but the PPN must be 12 and it must have a valid and dirty bit.
c. Assume virtual addresses from 0x1000 0000 0000 to 0x1000 ffff ffff and from 0x7000 1000
0000 to 0x9fff ffff ffff are in use. How much space does your page table occupy?
Doesn’t matter. You need to cover the whole address space. There are 2^(48-20)=2^28 pages, and thus
2^28 PTEs. Each PTE is 2 bytes, so we need 2^(28 + 1) = 2^29 bytes to store the page table. It is 512MB,
1/8 of the physical address space.
d. Describe a plausible 2-level page table approach for this system and repeat a-c assuming that
approach.
Any division is reasonable, but they must get the math right. Let’s divide (48 - 20) = 28 bits evenly, so
each level is 14 bits. Notice with 16 bit PTEs, 2^14 PTEs fit into 2^15 bytes, less than 1 page. Let's go with
that. Now, we will have one 1 page long top level page table, with 2^14 leaf page tables, each 1 pages long.
For part C:
0x1000 0000 0000 to 0x1000 00ff ffff => top level page table plus 1 leaf table
0x7000 1000 0000 to 0x9fff ffff ffff => top level plus 3*2^10 leaf tables
Total: 1 + 1+ 3*2^10 tables ~ 3*2^10 tables * 2^20 bytes = > 3*2^30 bytes
It is larger than the single level page table, because leaf table’s size isn’t fully utilized.
Since we can put 2^19 PTEs in one page, we could also allocate 9 bits for the first level, 19 bits for the
second level. In this case, the answer to (c) would be like:
0x1000 0000 0000 to 0x1000 00ff ffff => top level page table plus 1 leaf table
0x7000 1000 0000 to 0x9fff ffff ffff => top level plus 3*2^5 leaf tables
Total: 1 + 1+ 3*2^5 tables ~ 3*2^5 tables * 2^20 bytes = > 3*2^25 bytes =96MB
[Show Less]