Question
Q1. Suppose we have a virtual memory of size 2 Terabytes (2048GB, or 241 bytes), where pages are 8KB (213 bytes) each, and the machine
Q1. Suppose we have a virtual memory of size 2 Terabytes (2048GB, or 241 bytes), where pages are 8KB (213 bytes) each, and the machine has 4GB (232 bytes) of physical memory. a) Compute the number of page table entries needed if all the pages are being used. b) Compute the size of the page table if each page table entry also required 4 additional bits (valid, protection, dirty, use). Q2. For this problem, you are given a system with a virtual memory. The virtual memry hads the following configuration Physical addresses are 8 bits long, but only 27 = 128 bytes of physical memory is installed, at physical addresses 0 up to 127. Pages are 24 = 16 bytes long. Virtual addresses are 10 bits long. An exception will be raised if a program accesses a virtual address whose virtual page has no mapping in the page table. Exception will also be raise if this is mapped to a physical page outside of installed physical memory. The main memory contents are shown in Table 1. To find the physical address of a byte, you need to read the least significant digit from the column label and the most significant digit from the row label. For example, the shaded byte in the second row is at physical address 0x12. All entries are in hexadecimal.
Problem 2 [12 points] Consider a tiny system with virtual memory. Physical addresses are 8 bits long, but only 27 = 128 bytes of physical memory is installed, at physical addresses 0 up to 127. Pages are 24 = 16 bytes long. Virtual addresses are 10 bits long. An exception is raised if a program accesses a virtual address whose virtual page has no mapping in the page table, or is mapped to a physical page outside of installed physical memory. The contents of main memory are shown in Table . To find the physical address of a byte, read the least significant digit from the column label and the most significant digit from the row label. For example, the shaded byte in the second row is at physical address 0x12. All entries are in hexadecimal.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
0x0 | 4e | 65 | 76 | 65 | 72 | 20 | 67 | 6f | 6e | 6e | 61 | 20 | 67 | 69 | 76 | 65 |
0x1 | 20 | 79 | 6f | 75 | 20 | 75 | 70 | 0a | 4e | 65 | 76 | 65 | 72 | 20 | 67 | 6f |
0x2 | 6e | 6e | 21 | 20 | 6c | 65 | 74 | 20 | 79 | 6f | 75 | 20 | 64 | 6f | 77 | 6e |
0x3 | 0a | 4e | 65 | 76 | 65 | 77 | 20 | 67 | 6f | 6e | 6e | 61 | 20 | 72 | 75 | 6e |
0x4 | 20 | 61 | 72 | 6f | 75 | 6e | 64 | 20 | 61 | 6e | 64 | 20 | 64 | 65 | 73 | 65 |
0x5 | 72 | 74 | 20 | 79 | 6f | 75 | 0a | 4e | 65 | 76 | 65 | 72 | 67 | 6f | 6e | 6e |
0x6 | 6e | 61 | 20 | 6d | 61 | 6b | 65 | 20 | 79 | 6f | 75 | 20 | 63 | 72 | 79 | 0a |
0x7 | 4e | 65 | 76 | 65 | 72 | 20 | 67 | 6f | 6e | 6e | 61 | 20 | 73 | 61 | 79 | 20 |
The page table is shown in Table 2. The virtual page number in the left column is mapped to the physical page number in the second column. Virtual page numbers are listed in binary.
Virtual Page | Physical Page |
0 | 0x2 |
1 | 0x4 |
10 | 0x1 |
11 | 0x5 |
100 | 0x4 |
101 | 0x7 |
110 | 0x9 |
a) List the four bytes in the word beginning at physical address 0x34. b) How many virtual addresses refer to the first byte of the shaded word in row 0x2 ? List them ALL. c) How many virtual addresses refer to the first byte of the shaded word in row 0x4 ? List them ALL. d) List all virtual addresses that refer to the first byte of the shaded word in row 0x6. e) If the program loads a word from virtual address 0x5C (01011100), write down what data is returned? f) What is the result if the program loads a word from virtual address 0x64 (01100100)?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started