This quiz checks your understanding of the lectures and reading assignments. You may reference the textbook, lecture slides, and your notes. Online sites (e.g., Wikipedia) may also be consulted but you must cite them in your writeup.
Each question is worth three points. Please strive for clarity and brevity in your answers.
Submit your answers by clicking the "submit" link on the lecture schedule page. Only online submissions will be accepted. Please use this template when preparing your answers, and submit a plain ASCII text file.
Suppose a system has 64KB of physical memory and each process has 32KB of address space. The system uses virtual memory with paging and has a page size of 4KB. All addresses (virtual and physical) are given by 32-bit words. Consider a process with the following page table:
VPN 0: 0x80000006 VPN 1: 0x80000003 VPN 2: 0x8000000d VPN 3: 0x80000002 VPN 4: 0x80000005 VPN 5: 0x00000000 VPN 6: 0x8000000f VPN 7: 0x00000000
The format of the page table is: the high-order (leftmost) bit is the VALID bit. If the VALID bit is 1, the rest of the bits are the Page Frame Number (PFN); if the VALID bit is 0, the page is not valid. For each virtual address listed below, either give the physical address to which it maps to or say that it is invalid.
Assume a system with 3 page frames and the following sequence of page accesses: 5, 4, 2, 1, 3, 2, 4, 1, 2, 3.
For each of the following policies, indicate whether each reference results in a hit (H) or a miss (M) and the total number of hits. (Your answers should look something like: M, M, H, M, H, H, M, M, M, M - 3 hits.)
Suggested solution: CoW allows memory to be copied from one process to another with very little initial overhead. Many UNIX systems use it when a parent process forks a child. To implement CoW for a page, the VM system maps virtual pages in the address spaces of two different processes to the same page frame in physical memory; the virtual pages are marked read-only in both address spaces. Both processes can then read the page. However, if one process writes to the page, then a page fault occurs. At this time the OS copies the page to a new page frame and fixes the page table of the process to point to the new page.
Suggested solution: The key is that any time a privileged instruction is executed by the process or OS, control traps to the VMM. So the control flow looks like: