Virtual Memory Practice
Transcription
Virtual Memory Practice
Virtual Memory Practice Problem 1: This problem concerns the way virtual addresses are translated into physical addresses. Imagine a system has the following parameters: Virtual addresses are 20 bits wide. Physical addresses are 18 bits wide. The page size is 1024 bytes. The TLB is 2-way set associative with 16 total entries. The contents of the TLB and the first 32 entries of the page table are shown as follows. All numbers are given in hexadecimal. 1. How many bits are there in each of the following: Virtual Page Number, Virtual Page Offset, Physical Page Number, Physical Page Offset, TLB Index, and TLB Tag 2. For each of the following virtual addresses, indicate the following: a. VPN, VPOFS, TLB Index, TLB Tag b. Determine if this is a TLB hit and/or a page fault c. Determine the PPN and PPOFS (if there’s a page fault, indicate as such) Virtual Address 1: 0x078E6 Virtual Address 2: 0x04AA4 Problem 2: Consider a 32-bit system with 4 GB physical memory. The page size is 1 MB. Suppose that a single process running on the system. This process is using the following areas of its virtual memory: 0x00660000 to 0x00666600; 0x07999400 to 0x08000000; 0x00001000 to 0x00001400. Given these conditions, determine the size of the page tables required in each of the following page table system: 1-level, 2-level, and 3-level. Problems adapted from http://www.cs.cmu.edu/afs/cs/academic/class/15213-s03/www/vm_examples.pdf