Can someone please help and explain the C code that I would need for this. I am new to C and would like some help. I also do not know how to check the storage for the cache on my microsoft surface 2 computer.  Define Data Structures Large Arrays: Define a large array in memory. The size should be chosen based on the cache size of the target processor. Choose a size that is larger than the L3 cache of the processor.  You will need to look up the sizes of the L1, L2, and L3 for the processor you are using. Access Area: Access areas within the L1, L2, L3, and larger than the L3 cache.  You must read memory the same number of times for each, but simply access more memory for each. Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.For example if the L1 cache is 1K, then access the within the 1K 1000 times.  If the L2 cache is 10K, then access within the 10K 100 times..  Both are accessing 1,000,000 bytes of memory, Access Pattern Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits. Measure Time High-Resolution Timer: Utilize processor-specific instructions to access a high-resolution timer. Record the start and end time for accessing each array.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

Can someone please help and explain the C code that I would need for this. I am new to C and would like some help. I also do not know how to check the storage for the cache on my microsoft surface 2 computer.

 Define Data Structures

  • Large Arrays: Define a large array in memory. The size should be chosen based on the cache size of the target processor. Choose a size that is larger than the L3 cache of the processor. 
  • You will need to look up the sizes of the L1, L2, and L3 for the processor you are using.

Access Area:

  • Access areas within the L1, L2, L3, and larger than the L3 cache. 
  • You must read memory the same number of times for each, but simply access more memory for each.
    • Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster.
    • Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.For example if the L1 cache is 1K, then access the within the 1K 1000 times.  If the L2 cache is 10K, then access within the 10K 100 times..  Both are accessing 1,000,000 bytes of memory,

      Access Pattern

      • Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster.
      • Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.

      Measure Time

      • High-Resolution Timer: Utilize processor-specific instructions to access a high-resolution timer. Record the start and end time for accessing each array.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning