CS202: HW 6: virtual memory

CS202: HW 6: virtual memory

These problems should be done on your own. You get credit if you turn in something, and we are not checking the correctness. So these exercises exist purely to reinforce the material, not to evaluate you.

Getting help from AI (besides being ruled out by the course policies) will actually hurt you, since the point of these questions is for you to gain the practice and experience of working through the problems.

You will need that general skill (of absorbing something by practicing it) in life, and in this semester you will need the specific problem-solving skills that are emphasized in these homeworks.

Virtual memory: warmup

This question is borrowed from CS:APP3e [Computer Systems: A Programmer’s Perspective (Third Edition), by Randy Bryant and David R. O’Hallaron].

Complete the following table, filling in the missing entries and replacing each question mark with the appropriate integer. Use the following units: K = 210 (kilo), M = 220 (mega), G = 230 (giga), T = 240 (tera), P = 250 (peta), or E = 260 (exa).

Number of virtual address bits Number of virtual addresses Largest possible virtual address
4 16 16 − 1 = 15
8 ____ ____
____ 2? = 64 K ____
____ ____ 232 − 1 = ? G - 1
____ 2? = 256 T ____
64 ____ ____

Virtual memory: paging

This question is also borrowed from CS:APP3e.

Determine the number of page table entries (PTEs) that are needed for the following combinations of virtual address size (n) and page size (P).

n P Number of PTEs
16 4K ____
16 8K ____
32 4K ____
32 8K ____
48 4K ____

Virtual memory: address translation

This question is also borrowed from CS:APP3e, and lightly modified.

Given a 32-bit virtual address space and a 24-bit physical address, determine the number of bits in the VPN, PPN (your book, OSTEP, calls this PFN), and offset, for the following page sizes P:

P # of VPN bits # of PPN bits # of offset bits
1 KB ____ ____ ____
2 KB ____ ____ ____
4 KB ____ ____ ____
8 KB ____ ____ ____

Handing in the homework

Use Gradescope; you can enroll in our course with entry code J44YWJ.