A small computer has a direct-mapped data cache of size 1 kilo Bytes. lts block size is 32 bytes, hit time is 2 processor clock cycles, and, the miss penalty is 20 processor clock cyclesWhile running a loop, in each iteration data (of size 1 byte) is accessed from memory addresses 6, 522, 768, 1028. If the loop iterates 10 times, compute the average data access time for the loop.
Question
A small computer has a direct-mapped data cache of size 1 kilo Bytes. lts block size is 32 bytes, hit time is 2 processor clock cycles, and, the miss penalty is 20 processor clock cyclesWhile running a loop, in each iteration data (of size 1 byte) is accessed from memory addresses 6, 522, 768, 1028. If the loop iterates 10 times, compute the average data access time for the loop.
Solution
Sure, I can help you with that. Let's calculate the average data access time for the loop.
-
Calculate the number of blocks in the cache: Cache size = 1 kilo Bytes = 1024 bytes Block size = 32 bytes Number of blocks = Cache size / Block size = 1024 / 32 = 32 blocks
-
Calculate the number of cache hits and misses in each iteration: In each iteration, we access data of size 1 byte from memory addresses 6, 522, 768, and 1028.
For address 6: Block number = Address / Block size = 6 / 32 = 0 (since it is a direct-mapped cache) Cache hit or miss? Since this is the first access, it will be a cache miss.
For address 522: Block number = Address / Block size = 522 / 32 = 16 Cache hit or miss? Since block 16 is already in the cache, it will be a cache hit.
For address 768: Block number = Address / Block size = 768 / 32 = 24 Cache hit or miss? Since block 24 is already in the cache, it will be a cache hit.
For address 1028: Block number = Address / Block size = 1028 / 32 = 32 Cache hit or miss? Since block 32 is not in the cache, it will be a cache miss.
So, in each iteration, we have 2 cache hits and 2 cache misses.
-
Calculate the total time for cache hits and misses in each iteration: Hit time = 2 processor clock cycles Miss penalty = 20 processor clock cycles
Time for cache hits = Number of cache hits * Hit time = 2 * 2 = 4 processor clock cycles Time for cache misses = Number of cache misses * Miss penalty = 2 * 20 = 40 processor clock cycles
-
Calculate the total time for the loop: Total time = (Time for cache hits + Time for cache misses) * Number of iterations = (4 + 40) * 10 = 440 processor clock cycles
-
Calculate the average data access time for the loop: Average data access time = Total time / Number of iterations = 440 / 10 = 44 processor clock cycles
Therefore, the average data access time for the loop is 44 processor clock cycles.
Similar Questions
A computer with cache access time of 100 ns and hit ratio of 0·9 produces an average access time o
A computer with cache access time of 100 ns and hit ratio of 0·9 produces an average access time of ans. b)200ns a)250ns c)190ns d)none of these.
If the same 1 kilo Byte cache had been organized as a two-way set associative cache (other specifications remaining the same), then what would have been the average data access time for the loop?
Assume 40% of the instructions are data accessing instruction. Let a hit take 1 clock cycle and the miss penalty is 100 clock cycle. Assume instruction miss rate is 4% and data access miss rate is 12%, what is the average memory access time?
has the shortest access times.a.Registersb.Cache Memoryc.Virtual Memoryd.Secondary Memory
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.