 |
Glossary |
 |
Index |
|
|
Exercises
-
Hints and Answers Suppose a computer using direct mapped cache has 220 words of main memory and a cache of 32 blocks, where each cache block contains 16 words.
-
Hints and Answers How many blocks of main memory are there?
-
Hints and Answers What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, block, and word fields?
-
Hints and Answers To which cache block will the memory reference 0DB6316 map?
-
Suppose a computer using direct mapped cache has 232 words of main memory and a cache of 1024 blocks, where each cache block contains 32 words.
-
How many blocks of main memory are there?
-
What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, block, and word fields?
-
To which cache block will the memory reference 000063FA16 map?
-
Hints and Answers Suppose a computer using fully associative cache has 216 words of main memory and a cache of 64 blocks, where each cache block contains 32 words.
-
Hints and Answers How many blocks of main memory are there?
-
Hints and Answers What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag and word fields?
-
Hints and Answers To which cache block will the memory reference F8C916 map?
-
Suppose a computer using fully associative cache has 224 words of main memory and a cache of 128 blocks, where each cache block contains 64 words.
-
How many blocks of main memory are there?
-
What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag and word fields?
-
To which cache block will the memory reference 01D87216 map?
-
Hints and Answers Assume a system's memory has 128M words. Blocks are 64 words in length and the cache consists of 32K blocks. Show the format for a main memory address assuming a 2-way set associative cache mapping scheme. Be sure to include the fields as well as their sizes.
-
A 2-way set associative cache consists of four sets. Main memory contains 2K blocks of eight words each.
-
Show the main memory address format that allows us to map addresses from main memory to cache. Be sure to include the fields as well as their sizes.
-
Compute the hit ratio for a program that loops 3 times from locations 8 to 51 in main memory. You may leave the hit ratio in terms of a fraction.
-
Suppose a computer using set associative cache has 216 words of main memory and a cache of 32 blocks, and each cache block contains 8 words.
-
If this cache is 2-way set associative, what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, set, and word fields?
-
If this cache is 4-way set associative, what is the format of a memory address as seen by the cache?
-
Suppose a computer using set associative cache has 221 words of main memory and a cache of 64 blocks, where each cache block contains 4 words.
-
If this cache is 2-way set associative, what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, set, and word fields?
-
If this cache is 4-way set associative, what is the format of a memory address as seen by the cache?
-
* Suppose we have a computer that uses a memory address word size of 8 bits. This computer has a 16-byte cache with 4 bytes per block. The computer accesses a number of memory locations throughout the course of running a program.
Suppose this computer uses direct-mapped cache. The format of a memory address as seen by the cache is shown here:
The system accesses memory addresses (in hex) in this exact order: 6E, B9, 17, E0, 4E, 4F, 50, 91, A8, A9, AB, AD, 93, and 94. The memory addresses of the first four accesses have been loaded into the cache blocks as shown below. (The contents of the tag are shown in binary and the cache "contents" are simply the address stored at that cache location.)
-
What is the hit ratio for the entire memory reference sequence given above?
-
What memory blocks will be in the cache after the last address has been accessed?
-
A direct-mapped cache consists of eight blocks. Main memory contains 4K blocks of eight words each. Access time for the cache is 22ns and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory (so if it is not found in cache, we do not have to add this cache search time to the memory access). If a block is missing from cache, the entire block is brought into the cache and the access is restarted. Initially, the cache is empty.
-
Show the main memory address format that allows us to map addresses from main memory to cache. Be sure to include the fields as well as their sizes.
-
Compute the hit ratio for a program that loops 4 times from locations 0 to 6710 in memory.
-
Compute the effective access time for this program.
-
Consider a byte-addressable computer with 24-bit addresses, a cache capable of storing a total of 64KB of data, and blocks of 32 bytes. Show the format of a 24-bit memory address for:
-
direct mapped
-
associative
-
4-way set associative
-
Suppose a process page table contains the entries shown below. Using the format shown in Figure 6.15a, indicate where the process pages are located in memory.
-
Hints and Answers Suppose a process page table contains the entries shown below. Using the format shown in Figure 6.15a, indicate where the process pages are located in memory.
-
* You have a virtual memory system with a two-entry TLB, a 2-way set associative cache, and a page table for a process P. Assume cache blocks of 8 words and page size of 16 words. In the system below, main memory is divided into blocks, where each block is represented by a letter. Two blocks equal one frame.
Given the system state as depicted above, answer the following questions:
-
How many bits are in a virtual address for process P? Explain.
-
How many bits are in a physical address? Explain.
-
Show the address format for virtual address 1810 (specify field name and size) that would be used by the system to translate to a physical address and then translate this virtual address into the corresponding physical address. (Hint: convert 18 to its binary equivalent and divide it into the appropriate fields.) Explain how these fields are used to translate to the corresponding physical address.
-
Given a virtual memory system with a TLB, a cache, and a page table, assume the following:
-
A TLB hit requires 5ns.
-
A cache hit requires 12ns.
-
A memory reference requires 25ns.
-
A disk reference requires 200ms (this includes updating the page table, cache, and TLB).
-
The TLB hit ratio is 90%.
-
The cache hit rate is 98%.
-
The page fault rate is .001%.
-
On a TLB or cache miss, the time required for access includes a TLB and/or cache update, but the access is not restarted.
-
On a page fault, the page is fetched from disk, all updates are performed, but the access is restarted.
-
All references are sequential (no overlap, nothing done in parallel).
For each of the following, indicate whether or not it is possible. If it is possible, specify the time required for accessing the requested data.
-
TLB hit, cache hit
-
TLB miss, page table hit, cache hit
-
TLB miss, page table hit, cache miss
-
TLB miss, page table miss, cache hit
-
TLB miss, page table miss
Write down the equation to calculate the effective access time.
-
A system implements a paged virtual address space for each process using a one-level page table. The maximum size of virtual address space is 16MB. The page table for the running process includes the following valid entries (the ® notation indicates that a virtual page maps to the given page frame, that is, it is located in that frame):
Virtual page 2 ® Page frame 4 Virtual page 4 ® Page frame 9
Virtual page 1 ® Page frame 2 Virtual page 3 ® Page frame 16
Virtual page 0 ® Page frame 1
The page size is 1024 bytes and the maximum physical memory size of the machine is 2MB.
-
How many bits are required for each virtual address?
-
How many bits are required for each physical address?
-
What is the maximum number of entries in a page table?
-
To which physical address will the virtual address 152410 translate?
-
Which virtual address will translate to physical address 102410?
-
-
If you are a computer builder trying to make your system as price-competitive as possible, what features and organization would you select for its memory hierarchy?
-
If you are a computer buyer trying to get the best performance from a system, what features would you look for in its memory hierarchy?
-
* Consider a system that has multiple processors where each processor has its own cache, but main memory is shared among all processors.
-
Which cache write policy would you use?
-
The Cache Coherency Problem. With regard to the system just described, what problems are caused if a processor has a copy of memory block A in its cache and a second processor, also having a copy of A in its cache, then updates main memory block A? Can you think of a way (perhaps more than one) of preventing this situation, or lessening its effects?
-
* Pick a specific architecture (other than the one covered in this chapter). Do research to find out how your architecture approaches the concepts introduced in this chapter, as was done for Intel's Pentium.
|