Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume Computer XY has a 4 GB main memory and a direct - mapped ( L 1 ) cache ( there are no other cache

Assume Computer XY has a 4 GB main memory and a direct-mapped (L1) cache (there are no other cache levels and no secondary or tertiary storage) with a 32B line size. On XY, cache hits take 2 clock cycles, and cache misses take 90 clock cycles. Also on XY, if the CPU had disabled the cache and went directly to main memory, the main memory access time would be 100 cycles.
If Program A was run on XY when XY had a 32 KB L1 cache and A is a program that has a 2 GB array of (32 bit) integers (and essentially no other use of memory) that is accessed in a sequential way and thus has high spatial locality of reference, what would the overall average memory access time be in terms of CPU clock cycles? If the cache was instead a fully associative cache, what effect would you expect that to have on memory access time for this scenario? (N.B.: in cache memory discussions K is not 1000, instead it denotes 2^10.)
To calculate the hit rate, we need to determine the number of cache hits and cache misses.
Given:
- Cache Line Size =32B
- L1 Cache Size =32 KB =\(32\times 2^{10}\) bytes
- Array Size =2 GB of 32-bit integers =\(2\times 2^{30}\) bytes
We have previously calculated:
- Number of cache lines =1024
- Total number of integers in the array =\(2^{29}\)
- Number of cache lines needed to accommodate the array =\(2^{26}\)
Since the cache has 1024 cache lines and the number of cache lines needed to accommodate the array is \(2^{26}\), all the memory blocks needed for the array can fit into the cache at some point.
Now, let's calculate the hit rate:
Number of cache hits = Total number of accesses - Number of cache misses
Total number of accesses = Total number of integers in the array =\(2^{29}\)
Number of cache misses = Number of cache lines needed to accommodate the array =\(2^{26}\)
So,
Number of cache hits =????
Given:
- Cache Line Size =32B
- L1 Cache Size =32 KB =\(32\times 2^{10}\) bytes
- Array Size =2 GB of 32-bit integers =\(2\times 2^{30}\) bytes
Since the integers are 32 bits (4 bytes) each, the array contains \(\frac{2\times 2^{30}}{4}\) integers. With sequential access and high spatial locality, most accesses will hit in the cache after the initial miss that loads a line. Each line can hold \(\frac{32}{4}=8\) integers, so the miss rate is effectively the fraction of accesses that require a new line to be loaded.
For a direct-mapped cache, each new line access after every 8 integer accesses will likely result in a cache miss (assuming no conflict or capacity misses, which is optimistic). Thus, the miss rate can be approximated as \(\frac{1}{8}\).
What is the overall hit rate here ????? As said above for one line the hit rate was 7/8, for computing (or) accessing the overall array elements what is the hit rate????

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago