Question

Consider a cache of 8 lines of 16 bytes each. Main memory is divided into blocks...

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 1; blocks 1, 9, and so on to line 2; and so on. Compute the hit ratio during this process. Provide details regarding how you get the answer.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Block size => 16 Bytes -> Block offset = log 16 = 4 bits.

Let's see how address is stored in main memory block.

Address Range Main Memory Block #
0-15 Block 0
16 - 31 Block 1
32-47 Block 3
48 - 63 Block 4

A whole main memory block will be brought into one cache block.

Let's see how many miss we have in each reference:

10 through 20 -> These address are occupied in block 0 and 1 of memory . So these 2 block of memory will be brought in cache leading to miss. One miss per block for loading into cache.

Total 2 miss. (Block 0 and Block 1 of MM is brought in cache)

32 through 52 -> Total 2 miss (Block 1 and block 2 is brought in 1st and 2nd block of cache)

Now since there is no block replacement, all reference for next 2 loop will be hit.

Once : 20 - 35 : This is also a hit since already the required block is present in cache.

Now total # of reference =>3 *(11+21) + 16 = 112

Total # of miss = 2. So total #of hits = 112 - 2 =120

So Hit rate = 120/122 *100 = 98.36%

If you have any questions comment down and please? upvote thanks

Add a comment
Know the answer?
Add Answer to:
Consider a cache of 8 lines of 16 bytes each. Main memory is divided into blocks...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 10 (10 points) Consider a cache of 8 lines of 16 bytes each. Main memory...

    Question 10 (10 points) 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...

  • Consider a direct-mapped cache with 32 blocks Cache is initially empty, Block size = 16 bytes...

    Consider a direct-mapped cache with 32 blocks Cache is initially empty, Block size = 16 bytes The following memory addresses (in hexadecimal) are referenced: 0x2B4, 0x2B8, 0x2BC, 0x3E8, 0x3EC,0x4F0, 0x8F4, 0x8F8, 0x8FC. Map addresses to cache blocks and indicate whether hit or miss

  • A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...

    A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes 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...

  • 32 bytes of memory. 16 bytes of 2-way setassociative cache, where blocks can go anywhere within...

    32 bytes of memory. 16 bytes of 2-way setassociative cache, where blocks can go anywhere within the set. Block is 4 bytes, set in cache is two blocks. Populate memory starting with 0-9, then upper case letters. Hint- with full associativity in the set: each block has its own set of Tag bits in the cache. Memory is not organized by sets, though blocks get assigned to sets, and load in the cache per set. A) Complete: Bits in Address...

  • 32 bytes of memory. 16 bytes of 2-way set-associative cache, where blocks can go anywhere within...

    32 bytes of memory. 16 bytes of 2-way set-associative cache, where blocks can go anywhere within the set. Block is 2 bytes, set in cache is two blocks. Populate memory starting with upper-case letters, then 0-5. Hint- with full associativity in the set: each block has its own set of Tag bits in the cache. Memory is not organized by sets, though blocks get assigned to sets, and load in the cache per set.
1) Break down the addressing: Tag...

  • Question 3: Consider a 32-bit physical address memory system with block size 16 bytes and a...

    Question 3: Consider a 32-bit physical address memory system with block size 16 bytes and a 32 blocks direct mapped cache. The cache is initially empty. The following decimal memory addresses are referenced 1020, 1006, 1022, 5106, 994, and 2019 Map the addresses to cache blocks and indicate whether hit or miss. Note: You must use the hexadecimal approach in solving this question. You must also show the computations of dividing the memory address into tag bits, cache index bits,...

  • Question 33 10 pts For a direct mapped cache of 4 blocks with a cache block...

    Question 33 10 pts For a direct mapped cache of 4 blocks with a cache block size of 1 byte, in which cache block will each memory location map to? The order of accesses if given by the operation number. Indicate if each access is a hit or a miss, and what the tag value is for each entry. Assume that the cache is initially empty, and the accesses are in order of appearance. REDRAW AND COMPLETE THE CACHE TABLE...

  • Assume the cache can hold 64 kB. Data are transferred between main memory and the cache...

    Assume the cache can hold 64 kB. Data are transferred between main memory and the cache in blocks of 4 bytes each. This means that the cache is organized as 16K=2^14 lines of 4 bytes each. The main memory consists of 16 MB, with each byte directly addressable by a 24-bit address (2^24 =16M). Thus, for mapping purposes, we can consider main memory to consist of 4M blocks of 4 bytes each. Please show illustrations too for all work. Part...

  • A direct-mapped cache has 4 blocks and each block holds four bytes of data. The memory...

    A direct-mapped cache has 4 blocks and each block holds four bytes of data. The memory system is byte-addressable. Determine if each of the memory references below is a hit (H) or miss (M). You assume the cache is initially empty and memory references are given in decimal. Reference 27 0 13 24 50 24 36 14 48 45 47 48 H/M?

  • A system uses 27-bit addresses and it has a 32KB of direct-mapped cache with 8 bytes...

    A system uses 27-bit addresses and it has a 32KB of direct-mapped cache with 8 bytes per block. Memory of this system is byte-addressed. How many blocks (lines) are in this cache? (don't write your answer in power of two) A/

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT