Compute the hit ratio for a program that loops 4 times from locations 0 to 6710 in main memory.
Total number of block = 9
We know that Block 0 has address from 0-7
We know that Block 8 has address from 64-67
For Block 0 --> We will have 7 hits and 1 miss
For Block 8 --> We will have 3 hits and 1 miss
All other blocks will have 1 miss each and all other access will be
hits
Looping 4 times we will get
Block 0 --> 28 hits and 4 misses
Block 1-7 --> 31 hits and 1 misses
Block 8 --> 12 hits and 4 misses
Total Hit ratio => (257/272 )x 100 => 94.48%
Thanks, PLEASE COMMENT if there is any concern.
Compute the hit ratio for a program that loops 4 times from locations 0 to 6710...
6. A 2-way set associative cache consists of four sets. Main memory contains 2K blocks of eight words each. a. 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. b. Compute the hit ratio for a program that loops 5 times from locations 8 to 51 in main memory. You may leave the hit ratio in terms of a fraction.
A 2-way set associative cache consists of four sets 0, 1, 2, 3. The main memory is word addressable (i.e. treat the memory as an array of words indexed by the address). It contains 2048 blocks 0 through 2047, and each block has eight words. (a) How many bits are needed to address the main memory? (b) Show how a main memory address will be translated into a tag, a set number, and an offset within a block. Illustrate this...
Let’s say that we have a 4-way set associative cache. The cache
has 16 sets in total. Main memory consists of 16K blocks of 16
words each, and word addressing is used. a. Show the address format
that is used to map main memory address to the cache. Include the
appropriate fields and their sizes. For the remaining questions,
assume that we have the following situation: We have a program that
loops 6 times from location 1209810 in memory to...
2. (15 points total, 3 pts each) Let’s say that we have a 4-way set associative cache. The cache has 16 sets in total. Main memory consists of 16K blocks of 16 words each, and word addressing is used. a. Show the address format that is used to map main memory address to the cache. Include the appropriate fields and their sizes. For the remaining questions, assume that we have the following situation: We have a program that loops 6...
suppose that execution time for a program is directly proportional to instruction access time and that access to an instruction in the cache is 20 times faster than access to an instruction in the main memory. assume that there is 96% chance to find the requested instruction in the cache (probability to find the requested instruction in the cache is 0.96), and also assume that if an instruction is not found in the cache, it must be first fetched from...
For a special computer system with 3 levels of cache, here are
the hit times and miss % for the different levels of cache
Please calculate the access time for this computer system.
Hit Miss% L1 Cache 1 Cycle 5% L2 Cache 5 Cycles 10% L3 Cache 20 Cycles 15% Main Memory 100 Cycles 20%
2. A computer uses virtual memory implemented by paging. The TLB lookup takes 150 ns and the update takes 300 ns. The PT lookup takes 2 us and the update takes 4 us. Loading a word from main memory onto the CPU takes 25 us and loading a page from the disk into main memory takes 20 ms. The TLB hit ratio is 0.3 and the main memory hit ratio is 0.4. Compute the average access time for a referenced...
Lab #6 Number Guessing Game – Loops and Nested Loops Requirements: Design, develop, test, and submit a program for a Number Guessing game. The program will select a random number between 0 and 100, allow the user to try up to 10 times to guess the number, and tell the user if each guess is too high, too low, or correct. The actual game portion must be a function...you can use more than one function in your program. The amount...
Consider a cache of 8 lines of 16 bytes each. Main memory is divided into blocks of 16 bytes each. That is, block 0 has bytes with addresses 0 through 15, and so on. Now consider a program that accesses memory in the following sequence of addresses: Loop three times: 10 through 20; 32 through 52. Once: 20 through 35. Suppose the cache is organized as direct mapped. Memory blocks 0, 8, 16 and so on are assigned to line...
I need help with this program. C++ Given a string, compute recursively (no loops) a new string where all appearances of "pi" have been replaced by "3.14". It should enter a string like: (xpix)--> and print out " x3.14x" (pi)--> and print out " 3.14p" (pipi)--> and print out " 3.143.14" This is what I have so far... #include<iostream> #include<string> using namespace std; string changePi(string str) { string left; if(str.length() < 2) return str; if(str.substr(0, 1).compare("pi")) return "3.14" + changePi(str.substr(2));...