Q2. For this problem, you are given a system with a virtual memory. The virtual
ID: 3702744 • Letter: Q
Question
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.
0x0
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
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)?
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 20Explanation / Answer
a)
Now we have to find the virtual memory
Number of pages in virtual memory
=size of virtual memory/page size
=2^10/2^4=2^6 pages.
B) No of pages in physical memory = Size of physical memory / Page size
=(2^8 / 2^4) =2^(8-4) =2^4 pages
No of pages frames in main memory = 2^8 / 2^4 Pages = 2^4 page frames.
c) The following steps are to be followed in a calculating page table entries for virtual memory:
analyze the page offset by using the formula log2 (page size in bytes).
Log2(2^4)=4. So, the page offset is 4 bits.From the above The total number of bits needed for virtual memory is 10 bits.
Now we have to Subtracting, page offset from total number of bits for virtual address is10-4=6 bits.
finally, The total number of page table entries to represent all virtual addresses is 2^6 entries.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.