August
1999 QUESTION 4 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
An important feature
in designing a system is the construction of its memory hierarchy.
|
||
(a) | Draw a diagram showing the main elements of the memory hierarchy and showing with arrows how the size, cost and access time vary for the different forms of memory. | [4] |
|
||
(b) | What is the purpose of virtual memory? Will the virtual memory address space be larger or smaller than the physical memory address space? Explain your answer. | [4] |
Virtual memory allows
main memory to act as a cache for secondary storage. It permits the total memory needed by
all programs to be larger than the physical memory, by holding in main memory only those
block s needed by the currently running program. Also, it allows a single program to
exceed the size of the primary memory; sections of the program being brought into memory
when needed. For these reasons, the virtual address space must be larger than the physical
address space.
|
||
(c) | In virtual memory, what is the page table? | [4] |
The page table is used
to locate data. It is indexed by virtual page numbers from the virtual address, mapping
from virtual addresses to physical addresses. The page table resides in memory, the page
table register points to its start. A 'valid' bit indicates whether or not the mapping is
legal - if not, a page fault occurs.
|
||
(d) | Using the page table can mean that each memory access takes twice as long as it would without virtual memory. Explain why this is, and how a translation lookaside buffer (TLB) may be used to overcome this difficulty. | [4] |
The page table is
large, and so it must be stored in main memory. This makes memory access expensive because
for each memory access, one access is needed to obtain the physical address, and another
is needed to fetch the actual data. The TLB acts as a cache on the page table, holding a subset of the virtual-to-physical page mappings, as well as a reference bit and dirty bit. If there is no matching entry in the TLB for a requested page, the page table must be examined.
|
||
(e) | In which ways are virtual memory and the cache similar? What are the main differences? | [4] |
Both was used to speed
up accesses to frequently-used data. Both are based on the principle of locality. They differ in their position in the memory hierarchy. They differ in the size of the artefacts - blocks in the case of the cache,; pages in the case of virtual memory.
|